mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-11 01:38:25 +02:00
Saemtliche unbenutzte Patches aus dem Repository geworfen.
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@489 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
--- CnxADSL-TgrATM_k2.4.3-6.1.2.007CLN/KernelModule/ChipALCdsl.h.old Fri Oct 1 06:49:52 2004
|
|
||||||
+++ CnxADSL-TgrATM_k2.4.3-6.1.2.007CLN/KernelModule/ChipALCdsl.h Mon Oct 4 23:19:36 2004
|
|
||||||
@@ -546,7 +546,7 @@
|
|
||||||
DWORD ComChannel // Communications Channel
|
|
||||||
);
|
|
||||||
|
|
||||||
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
|
|
||||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
|
|
||||||
typedef void irqreturn_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,212 +0,0 @@
|
|||||||
diff -ruN busybox-0.60.5.old/Config.h busybox-0.60.5/Config.h
|
|
||||||
--- busybox-0.60.5.old/Config.h Mon Sep 16 07:30:10 2002
|
|
||||||
+++ busybox-0.60.5/Config.h Mon Dec 8 09:57:27 2003
|
|
||||||
@@ -6,143 +6,35 @@
|
|
||||||
// i.e., //#define BB_BLAH
|
|
||||||
//
|
|
||||||
//
|
|
||||||
-// BusyBox Applications
|
|
||||||
-//#define BB_ADJTIMEX
|
|
||||||
-//#define BB_AR
|
|
||||||
-#define BB_ASH
|
|
||||||
-#define BB_BASENAME
|
|
||||||
-#define BB_CAT
|
|
||||||
-#define BB_CHGRP
|
|
||||||
-#define BB_CHMOD
|
|
||||||
-#define BB_CHOWN
|
|
||||||
-#define BB_CHROOT
|
|
||||||
-#define BB_CHVT
|
|
||||||
-#define BB_CLEAR
|
|
||||||
-//#define BB_CMP
|
|
||||||
-#define BB_CP
|
|
||||||
-//#define BB_CPIO
|
|
||||||
-#define BB_CUT
|
|
||||||
-#define BB_DATE
|
|
||||||
-//#define BB_DC
|
|
||||||
-#define BB_DD
|
|
||||||
-//#define BB_DEALLOCVT
|
|
||||||
+// BusyBox Applications
|
|
||||||
+#define BB_ASH
|
|
||||||
+#define BB_CAT
|
|
||||||
+#define BB_CHROOT
|
|
||||||
+#define BB_DD
|
|
||||||
#define BB_DF
|
|
||||||
-#define BB_DIRNAME
|
|
||||||
-#define BB_DMESG
|
|
||||||
-//#define BB_DOS2UNIX
|
|
||||||
-//#define BB_DPKG
|
|
||||||
-//#define BB_DPKG_DEB
|
|
||||||
-//#define BB_DUTMP
|
|
||||||
-#define BB_DU
|
|
||||||
-//#define BB_DUMPKMAP
|
|
||||||
-#define BB_ECHO
|
|
||||||
-#define BB_ENV
|
|
||||||
-//#define BB_EXPR
|
|
||||||
-//#define BB_FBSET
|
|
||||||
-//#define BB_FDFLUSH
|
|
||||||
-#define BB_FIND
|
|
||||||
-#define BB_FREE
|
|
||||||
-//#define BB_FREERAMDISK
|
|
||||||
-//#define BB_FSCK_MINIX
|
|
||||||
-//#define BB_GETOPT
|
|
||||||
-#define BB_GREP
|
|
||||||
-#define BB_GUNZIP
|
|
||||||
-#define BB_GZIP
|
|
||||||
-#define BB_HALT
|
|
||||||
-#define BB_HEAD
|
|
||||||
-//#define BB_HOSTID
|
|
||||||
-//#define BB_HOSTNAME
|
|
||||||
-//#define BB_HUSH
|
|
||||||
-#define BB_ID
|
|
||||||
-//#define BB_IFCONFIG
|
|
||||||
-#define BB_INIT
|
|
||||||
-//#define BB_INSMOD
|
|
||||||
-#define BB_KILL
|
|
||||||
-#define BB_KILLALL
|
|
||||||
-#define BB_KLOGD
|
|
||||||
-//#define BB_LASH
|
|
||||||
-//#define BB_LENGTH
|
|
||||||
-#define BB_LN
|
|
||||||
-//#define BB_LOADACM
|
|
||||||
-//#define BB_LOADFONT
|
|
||||||
-//#define BB_LOADKMAP
|
|
||||||
-#define BB_LOGGER
|
|
||||||
-//#define BB_LOGNAME
|
|
||||||
-//#define BB_LOSETUP
|
|
||||||
-#define BB_LS
|
|
||||||
-#define BB_LSMOD
|
|
||||||
-//#define BB_MAKEDEVS
|
|
||||||
-//#define BB_MD5SUM
|
|
||||||
-#define BB_MKDIR
|
|
||||||
-//#define BB_MKFIFO
|
|
||||||
-//#define BB_MKFS_MINIX
|
|
||||||
-#define BB_MKNOD
|
|
||||||
-#define BB_MKSWAP
|
|
||||||
-//#define BB_MKTEMP
|
|
||||||
-#define BB_MODPROBE
|
|
||||||
-#define BB_MORE
|
|
||||||
-#define BB_MOUNT
|
|
||||||
-//#define BB_MSH
|
|
||||||
-//#define BB_MT
|
|
||||||
-#define BB_MV
|
|
||||||
-//#define BB_NC
|
|
||||||
-//#define BB_NSLOOKUP
|
|
||||||
-#define BB_PIDOF
|
|
||||||
-//#define BB_PING
|
|
||||||
-//#define BB_PIVOT_ROOT
|
|
||||||
-#define BB_POWEROFF
|
|
||||||
-//#define BB_PRINTF
|
|
||||||
-#define BB_PS
|
|
||||||
-#define BB_PWD
|
|
||||||
-//#define BB_RDATE
|
|
||||||
-//#define BB_READLINK
|
|
||||||
-#define BB_REBOOT
|
|
||||||
-//#define BB_RENICE
|
|
||||||
-#define BB_RESET
|
|
||||||
-#define BB_RM
|
|
||||||
-#define BB_RMDIR
|
|
||||||
-//#define BB_RMMOD
|
|
||||||
-//#define BB_ROUTE
|
|
||||||
-//#define BB_RPM2CPIO
|
|
||||||
+#define BB_ECHO
|
|
||||||
+#define BB_GUNZIP
|
|
||||||
+#define BB_GZIP
|
|
||||||
+#define BB_HALT
|
|
||||||
+#define BB_IFCONFIG
|
|
||||||
+#define BB_INSMOD
|
|
||||||
+#define BB_INIT
|
|
||||||
+#define BB_LS
|
|
||||||
+#define BB_MKSWAP
|
|
||||||
+#define BB_MODPROBE
|
|
||||||
+#define BB_MOUNT
|
|
||||||
+#define BB_REBOOT
|
|
||||||
+#define BB_RMMOD
|
|
||||||
#define BB_SED
|
|
||||||
-//#define BB_SETKEYCODES
|
|
||||||
-#define BB_SLEEP
|
|
||||||
-#define BB_SORT
|
|
||||||
-//#define BB_STTY
|
|
||||||
-#define BB_SWAPONOFF
|
|
||||||
-#define BB_SYNC
|
|
||||||
+#define BB_SLEEP
|
|
||||||
+#define BB_SWAPONOFF
|
|
||||||
#define BB_SYSLOGD
|
|
||||||
-#define BB_TAIL
|
|
||||||
-#define BB_TAR
|
|
||||||
-//#define BB_TEE
|
|
||||||
-//#define BB_TEST
|
|
||||||
-//#define BB_TELNET
|
|
||||||
-//#define BB_TFTP
|
|
||||||
-//#define BB_TIME
|
|
||||||
-//#define BB_TOP
|
|
||||||
-#define BB_TOUCH
|
|
||||||
-//#define BB_TR
|
|
||||||
-//#define BB_TRACEROUTE
|
|
||||||
-#define BB_TRUE_FALSE
|
|
||||||
-#define BB_TTY
|
|
||||||
-//#define BB_UNIX2DOS
|
|
||||||
-//#define BB_UUENCODE
|
|
||||||
-//#define BB_UUDECODE
|
|
||||||
-#define BB_UMOUNT
|
|
||||||
-#define BB_UNIQ
|
|
||||||
-#define BB_UNAME
|
|
||||||
-//#define BB_UPDATE
|
|
||||||
-#define BB_UPTIME
|
|
||||||
-//#define BB_USLEEP
|
|
||||||
-//#define BB_VI
|
|
||||||
-//#define BB_WATCHDOG
|
|
||||||
-#define BB_WC
|
|
||||||
-//#define BB_WGET
|
|
||||||
-#define BB_WHICH
|
|
||||||
-#define BB_WHOAMI
|
|
||||||
-#define BB_XARGS
|
|
||||||
-#define BB_YES
|
|
||||||
-// End of Applications List
|
|
||||||
+#define BB_TAR
|
|
||||||
+#define BB_UMOUNT
|
|
||||||
+#define BB_WGET
|
|
||||||
+#define BB_PING
|
|
||||||
+// End of Applications List
|
|
||||||
+
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
@@ -209,7 +101,7 @@
|
|
||||||
#define BB_FEATURE_LS_FOLLOWLINKS
|
|
||||||
//
|
|
||||||
// Use color to identify different file types
|
|
||||||
-#define BB_FEATURE_LS_COLOR
|
|
||||||
+
|
|
||||||
//
|
|
||||||
// Disable for a smaller (but less functional) ping
|
|
||||||
#define BB_FEATURE_FANCY_PING
|
|
||||||
@@ -333,7 +225,7 @@
|
|
||||||
//#define BB_FEATURE_MINIX2
|
|
||||||
//
|
|
||||||
// Enable ifconfig status reporting output -- this feature adds 7k.
|
|
||||||
-//#define BB_FEATURE_IFCONFIG_STATUS
|
|
||||||
+#define BB_FEATURE_IFCONFIG_STATUS
|
|
||||||
//
|
|
||||||
// Enable ifconfig slip-specific options "keepalive" and "outfill"
|
|
||||||
//#define BB_FEATURE_IFCONFIG_SLIP
|
|
||||||
diff -ruN busybox-0.60.5.old/insmod.c busybox-0.60.5/insmod.c
|
|
||||||
--- busybox-0.60.5.old/insmod.c Mon Sep 16 07:30:10 2002
|
|
||||||
+++ busybox-0.60.5/insmod.c Mon Dec 8 09:57:27 2003
|
|
||||||
@@ -3538,7 +3538,7 @@
|
|
||||||
* if it is a link... */
|
|
||||||
if (realpath (module_dir, real_module_dir) == NULL)
|
|
||||||
strcpy(real_module_dir, module_dir);
|
|
||||||
- recursive_action(real_module_dir, TRUE, FALSE, FALSE,
|
|
||||||
+ recursive_action(real_module_dir, TRUE, TRUE, FALSE,
|
|
||||||
check_module_name_match, 0, m_fullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -3550,7 +3550,7 @@
|
|
||||||
strcpy(module_dir, _PATH_MODULES);
|
|
||||||
/* No module found under /lib/modules/`uname -r`, this
|
|
||||||
* time cast the net a bit wider. Search /lib/modules/ */
|
|
||||||
- if (recursive_action(module_dir, TRUE, FALSE, FALSE,
|
|
||||||
+ if (recursive_action(module_dir, TRUE, TRUE, FALSE,
|
|
||||||
check_module_name_match, 0, m_fullName) == FALSE)
|
|
||||||
{
|
|
||||||
if (m_filename[0] == '\0'
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
--- busybox-0.60.5/insmod.c 2002-09-16 06:30:10.000000000 +0100
|
|
||||||
+++ busybox-0.60.5.gz/insmod.c 2003-12-29 17:43:56.000000000 +0000
|
|
||||||
@@ -3429,6 +3429,12 @@
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void delete_unziped_module(char *name)
|
|
||||||
+{
|
|
||||||
+ if (unlink(name) < 0)
|
|
||||||
+ fprintf(stderr, "Couldnt remove %s", name);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
extern int insmod_main( int argc, char **argv)
|
|
||||||
{
|
|
||||||
int opt;
|
|
||||||
@@ -3444,6 +3450,7 @@
|
|
||||||
char m_name[FILENAME_MAX] = "\0";
|
|
||||||
int exit_status = EXIT_FAILURE;
|
|
||||||
int m_has_modinfo;
|
|
||||||
+ int gunzip = 0;
|
|
||||||
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
|
|
||||||
struct utsname uts_info;
|
|
||||||
char m_strversion[STRVERSIONLEN];
|
|
||||||
@@ -3498,9 +3505,18 @@
|
|
||||||
tmp = basename(tmp1);
|
|
||||||
len = strlen(tmp);
|
|
||||||
|
|
||||||
- if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
|
|
||||||
- len-=2;
|
|
||||||
+ if (len > 5 && tmp[len - 5] == '.' && tmp[len - 4] == 'o' && tmp[len - 3] == '.' && tmp[len - 2] == 'g' && tmp[len - 1] == 'z') {
|
|
||||||
+ len-=5;
|
|
||||||
tmp[len] = '\0';
|
|
||||||
+ gunzip = 1;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') {
|
|
||||||
+ len-=2;
|
|
||||||
+ tmp[len] = '\0';
|
|
||||||
+ gunzip = 0;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
/* Make sure there is space for the terminal NULL */
|
|
||||||
len += 1;
|
|
||||||
@@ -3524,6 +3540,7 @@
|
|
||||||
(fp = fopen(argv[optind], "r")) == NULL) {
|
|
||||||
struct utsname myuname;
|
|
||||||
|
|
||||||
+AGAIN:
|
|
||||||
/* Hmm. Could not open it. First search under /lib/modules/`uname -r`,
|
|
||||||
* but do not error out yet if we fail to find it... */
|
|
||||||
if (uname(&myuname) == 0) {
|
|
||||||
@@ -3542,6 +3559,14 @@
|
|
||||||
check_module_name_match, 0, m_fullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* If we've not found anything, try the gzipped version */
|
|
||||||
+ if ((m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) && !gunzip)
|
|
||||||
+ {
|
|
||||||
+ strcat(m_fullName, ".gz");
|
|
||||||
+ gunzip = 1;
|
|
||||||
+ goto AGAIN;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Check if we have found anything yet */
|
|
||||||
if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL))
|
|
||||||
{
|
|
||||||
@@ -3565,11 +3590,52 @@
|
|
||||||
} else
|
|
||||||
safe_strncpy(m_filename, argv[optind], sizeof(m_filename));
|
|
||||||
|
|
||||||
+ if (gunzip)
|
|
||||||
+ {
|
|
||||||
+ FILE *fp_unziped;
|
|
||||||
+ int my_len;
|
|
||||||
+ char m_filename_unziped[FILENAME_MAX + 1] = "\0";
|
|
||||||
+
|
|
||||||
+ strcpy(m_filename_unziped, m_filename);
|
|
||||||
+ my_len = strlen(m_filename_unziped);
|
|
||||||
+ m_filename_unziped[my_len - 3] = '\0';
|
|
||||||
+
|
|
||||||
+ if ((fp_unziped = fopen (m_filename_unziped, "w")) == NULL)
|
|
||||||
+ {
|
|
||||||
+ perror(m_filename_unziped);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (unzip(fp, fp_unziped) != 0)
|
|
||||||
+ {
|
|
||||||
+ fclose(fp);
|
|
||||||
+ fclose(fp_unziped);
|
|
||||||
+ error_msg("unable to gunzip %s", m_filename_unziped);
|
|
||||||
+ delete_unziped_module(m_filename_unziped);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fclose(fp);
|
|
||||||
+ fclose(fp_unziped);
|
|
||||||
+
|
|
||||||
+ strcpy(m_filename, m_filename_unziped);
|
|
||||||
+
|
|
||||||
+ if ((fp = fopen (m_filename, "r")) == NULL)
|
|
||||||
+ {
|
|
||||||
+ perror(m_filename);
|
|
||||||
+ return EXIT_FAILURE;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
printf("Using %s\n", m_filename);
|
|
||||||
|
|
||||||
if ((f = obj_load(fp, LOADBITS)) == NULL)
|
|
||||||
- perror_msg_and_die("Could not load the module");
|
|
||||||
-
|
|
||||||
+ {
|
|
||||||
+ if (gunzip)
|
|
||||||
+ delete_unziped_module(m_filename);
|
|
||||||
+ perror_msg_and_die("Could not load the module");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (get_modinfo_value(f, "kernel_version") == NULL)
|
|
||||||
m_has_modinfo = 0;
|
|
||||||
else
|
|
||||||
@@ -3679,8 +3745,6 @@
|
|
||||||
|
|
||||||
/* Find current size of the module */
|
|
||||||
m_size = obj_load_size(f);
|
|
||||||
-
|
|
||||||
-
|
|
||||||
m_addr = create_module(m_name, m_size);
|
|
||||||
if (m_addr==-1) switch (errno) {
|
|
||||||
case EEXIST:
|
|
||||||
@@ -3723,5 +3787,7 @@
|
|
||||||
|
|
||||||
out:
|
|
||||||
fclose(fp);
|
|
||||||
+ if (gunzip)
|
|
||||||
+ delete_unziped_module(m_filename);
|
|
||||||
return(exit_status);
|
|
||||||
}
|
|
||||||
--- busybox-0.60.5/modprobe.c 2003-12-29 17:05:50.000000000 +0000
|
|
||||||
+++ busybox-0.60.5.gz/modprobe.c 2004-01-01 19:22:44.000000000 +0000
|
|
||||||
@@ -105,6 +105,9 @@
|
|
||||||
else
|
|
||||||
mods++;
|
|
||||||
|
|
||||||
+ if (( *(col-5) == '.' ) && ( *(col-4) == 'o' ) && ( *(col-3) == '.' ) && ( *(col-2) == 'g' ) && ( *(col-1) == 'z' ))
|
|
||||||
+ ext = 5;
|
|
||||||
+
|
|
||||||
if (( *(col-2) == '.' ) && ( *(col-1) == 'o' ))
|
|
||||||
ext = 2;
|
|
||||||
|
|
||||||
@@ -152,6 +155,9 @@
|
|
||||||
else
|
|
||||||
deps++;
|
|
||||||
|
|
||||||
+ if (( *(end-4) == '.' ) && ( *(end-3) == 'o' ) && ( *(end-2) == '.' ) && ( *(end-1) == 'g' ) && ( *end == 'z' ))
|
|
||||||
+ ext = 5;
|
|
||||||
+
|
|
||||||
if (( *(end-1) == '.' ) && ( *end == 'o' ))
|
|
||||||
ext = 2;
|
|
||||||
|
|
||||||
@@ -184,6 +190,9 @@
|
|
||||||
int lm = xstrlen ( mod );
|
|
||||||
int extpos = 0;
|
|
||||||
|
|
||||||
+ if (( mod [lm-5] == '.' ) && ( mod [lm-4] == 'o' ) && ( mod [lm-3] == '.' ) && ( mod[lm-2] == 'g' ) && ( mod[lm-1] == 'z' ))
|
|
||||||
+ extpos = 5;
|
|
||||||
+
|
|
||||||
if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' ))
|
|
||||||
extpos = 2;
|
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
Adds support for GPL symbols (those exported with EXPORT_SYMBOL_GPL instead
|
|
||||||
of EXPORT_SYMBOL) to insmod. This is a backport from later busybox versions,
|
|
||||||
it corresponds to revision 7301 in the busybox svn repository:
|
|
||||||
|
|
||||||
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/modutils/insmod.c?rev=7301&view=markup
|
|
||||||
--- busybox-0.60.5/insmod.c 2002-09-16 06:30:10.000000000 +0100
|
|
||||||
+++ busybox-0.60.5-symbols/insmod.c 2005-06-21 20:58:57.000000000 +0100
|
|
||||||
@@ -607,6 +607,8 @@
|
|
||||||
|
|
||||||
static void arch_create_got (struct obj_file *f);
|
|
||||||
|
|
||||||
+static int obj_gpl_license(struct obj_file *f, const char **license);
|
|
||||||
+
|
|
||||||
#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
|
|
||||||
static int arch_init_module (struct obj_file *f, struct new_module *);
|
|
||||||
#endif
|
|
||||||
@@ -1710,12 +1712,29 @@
|
|
||||||
size_t i;
|
|
||||||
int used = 0;
|
|
||||||
|
|
||||||
+ int gpl;
|
|
||||||
+ gpl = obj_gpl_license(f, NULL) == 0;
|
|
||||||
+
|
|
||||||
for (i = 0, s = syms; i < nsyms; ++i, ++s) {
|
|
||||||
|
|
||||||
/* Only add symbols that are already marked external. If we
|
|
||||||
override locals we may cause problems for argument initialization.
|
|
||||||
We will also create a false dependency on the module. */
|
|
||||||
struct obj_symbol *sym;
|
|
||||||
+ char *name;
|
|
||||||
+
|
|
||||||
+ /* GPL licensed modules can use symbols exported with
|
|
||||||
+ * EXPORT_SYMBOL_GPL, so ignore any GPLONLY_ prefix on the
|
|
||||||
+ * exported names. Non-GPL modules never see any GPLONLY_
|
|
||||||
+ * symbols so they cannot fudge it by adding the prefix on
|
|
||||||
+ * their references.
|
|
||||||
+ */
|
|
||||||
+ if (strncmp((char *)s->name, "GPLONLY_", 8) == 0) {
|
|
||||||
+ if (gpl)
|
|
||||||
+ ((char *)s->name) += 8;
|
|
||||||
+ else
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
sym = obj_find_symbol(f, (char *) s->name);
|
|
||||||
if (sym && !ELFW(ST_BIND) (sym->info) == STB_LOCAL) {
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
diff -u busybox-0.60.5.old/usage.h busybox-0.60.5/usage.h
|
|
||||||
--- busybox-0.60.5.old/usage.h 2002-09-30 21:59:58.000000000 +0100
|
|
||||||
+++ busybox-0.60.5/usage.h 2004-01-16 00:42:40.000000000 +0000
|
|
||||||
@@ -1901,12 +1901,13 @@
|
|
||||||
" 31 46 1365 /etc/passwd\n"
|
|
||||||
|
|
||||||
#define wget_trivial_usage \
|
|
||||||
- "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
|
|
||||||
+ "[-c|--continue] [-q|--quiet] [-s|--spider] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
|
|
||||||
#define wget_full_usage \
|
|
||||||
"wget retrieves files via HTTP or FTP\n\n" \
|
|
||||||
"Options:\n" \
|
|
||||||
"\t-c\tcontinue retrieval of aborted transfers\n" \
|
|
||||||
"\t-q\tquiet mode - do not print\n" \
|
|
||||||
+ "\t-s\tspider mode - check file exists\n" \
|
|
||||||
"\t-P\tSet directory prefix to DIR\n" \
|
|
||||||
"\t-O\tsave to filename ('-' for stdout)"
|
|
||||||
|
|
||||||
diff -u busybox-0.60.5.old/wget.c busybox-0.60.5/wget.c
|
|
||||||
--- busybox-0.60.5.old/wget.c 2002-04-27 08:40:00.000000000 +0100
|
|
||||||
+++ busybox-0.60.5/wget.c 2004-01-16 00:47:47.000000000 +0000
|
|
||||||
@@ -179,6 +179,7 @@
|
|
||||||
int got_clen = 0; /* got content-length: from server */
|
|
||||||
FILE *output; /* socket to web server */
|
|
||||||
int quiet_flag = FALSE; /* Be verry, verry quiet... */
|
|
||||||
+ int spider = FALSE; /* Just check file exists (-s) */
|
|
||||||
|
|
||||||
#define LONG_HEADER 1
|
|
||||||
struct option long_options[] = {
|
|
||||||
@@ -186,16 +187,20 @@
|
|
||||||
{ "quiet", 0, NULL, 'q' },
|
|
||||||
{ "output-document", 1, NULL, 'O' },
|
|
||||||
{ "header", 1, &which_long_opt, LONG_HEADER },
|
|
||||||
+ { "spider", 0, NULL, 's' },
|
|
||||||
{ 0, 0, 0, 0 }
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
* Crack command line.
|
|
||||||
*/
|
|
||||||
- while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) {
|
|
||||||
+ while ((n = getopt_long(argc, argv, "cqsO:P:", long_options, &option_index)) != EOF) {
|
|
||||||
switch (n) {
|
|
||||||
case 'c':
|
|
||||||
++do_continue;
|
|
||||||
break;
|
|
||||||
+ case 's':
|
|
||||||
+ spider = TRUE;
|
|
||||||
+ break;
|
|
||||||
case 'P':
|
|
||||||
dir_prefix = optarg;
|
|
||||||
break;
|
|
||||||
@@ -353,6 +358,8 @@
|
|
||||||
while (gethdr(buf, sizeof(buf), sfp, &n) != NULL);
|
|
||||||
goto read_response;
|
|
||||||
case 200:
|
|
||||||
+ if (spider)
|
|
||||||
+ exit(EXIT_SUCCESS);
|
|
||||||
if (do_continue && output != stdout)
|
|
||||||
output = freopen(fname_out, "w", output);
|
|
||||||
do_continue = 0;
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
--- wget.c.old 2004-04-07 09:23:21.000000000 +0100
|
|
||||||
+++ wget.c 2004-04-07 09:23:33.000000000 +0100
|
|
||||||
@@ -74,7 +74,9 @@
|
|
||||||
{
|
|
||||||
if (output != stdout && do_continue==0) {
|
|
||||||
fclose(output);
|
|
||||||
- unlink(fname_out);
|
|
||||||
+ /* if it's /dev/null, don't unlink it */
|
|
||||||
+ if (strcmp(fname_out, "/dev/null"))
|
|
||||||
+ unlink(fname_out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
--- bzip2-1.0.2/bzip2.c.nochmod 2005-05-10 16:19:45.000000000 +0200
|
|
||||||
+++ bzip2-1.0.2/bzip2.c 2005-05-10 16:22:00.000000000 +0200
|
|
||||||
@@ -312,6 +312,7 @@
|
|
||||||
|
|
||||||
static void copyFileName ( Char*, Char* );
|
|
||||||
static void* myMalloc ( Int32 );
|
|
||||||
+static int applySavedFileAttrToOutputFile ( int fd );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -457,6 +458,10 @@
|
|
||||||
ret = fflush ( zStream );
|
|
||||||
if (ret == EOF) goto errhandler_io;
|
|
||||||
if (zStream != stdout) {
|
|
||||||
+ int fd = fileno ( zStream );
|
|
||||||
+ if (fd < 0) goto errhandler_io;
|
|
||||||
+ ret = applySavedFileAttrToOutputFile ( fd );
|
|
||||||
+ if (ret != 0) goto errhandler_io;
|
|
||||||
ret = fclose ( zStream );
|
|
||||||
outputHandleJustInCase = NULL;
|
|
||||||
if (ret == EOF) goto errhandler_io;
|
|
||||||
@@ -567,6 +572,12 @@
|
|
||||||
|
|
||||||
closeok:
|
|
||||||
if (ferror(zStream)) goto errhandler_io;
|
|
||||||
+ if ( stream != stdout) {
|
|
||||||
+ int fd = fileno ( stream );
|
|
||||||
+ if (fd < 0) goto errhandler_io;
|
|
||||||
+ ret = applySavedFileAttrToOutputFile ( fd );
|
|
||||||
+ if (ret != 0) goto errhandler_io;
|
|
||||||
+ }
|
|
||||||
ret = fclose ( zStream );
|
|
||||||
if (ret == EOF) goto errhandler_io;
|
|
||||||
|
|
||||||
@@ -1125,7 +1136,7 @@
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
-void applySavedMetaInfoToOutputFile ( Char *dstName )
|
|
||||||
+void applySavedTimeInfoToOutputFile ( Char *dstName )
|
|
||||||
{
|
|
||||||
# if BZ_UNIX
|
|
||||||
IntNative retVal;
|
|
||||||
@@ -1134,16 +1145,26 @@
|
|
||||||
uTimBuf.actime = fileMetaInfo.st_atime;
|
|
||||||
uTimBuf.modtime = fileMetaInfo.st_mtime;
|
|
||||||
|
|
||||||
- retVal = chmod ( dstName, fileMetaInfo.st_mode );
|
|
||||||
- ERROR_IF_NOT_ZERO ( retVal );
|
|
||||||
-
|
|
||||||
retVal = utime ( dstName, &uTimBuf );
|
|
||||||
ERROR_IF_NOT_ZERO ( retVal );
|
|
||||||
+# endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static
|
|
||||||
+int applySavedFileAttrToOutputFile ( int fd )
|
|
||||||
+{
|
|
||||||
+# if BZ_UNIX
|
|
||||||
+ IntNative retVal;
|
|
||||||
+
|
|
||||||
+ retVal = fchmod ( fd, fileMetaInfo.st_mode );
|
|
||||||
+ if (retVal != 0)
|
|
||||||
+ return retVal;
|
|
||||||
|
|
||||||
- retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
|
|
||||||
+ (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
|
|
||||||
/* chown() will in many cases return with EPERM, which can
|
|
||||||
be safely ignored.
|
|
||||||
*/
|
|
||||||
+ return 0;
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1366,7 +1387,7 @@
|
|
||||||
|
|
||||||
/*--- If there was an I/O error, we won't get here. ---*/
|
|
||||||
if ( srcMode == SM_F2F ) {
|
|
||||||
- applySavedMetaInfoToOutputFile ( outName );
|
|
||||||
+ applySavedTimeInfoToOutputFile ( outName );
|
|
||||||
deleteOutputOnInterrupt = False;
|
|
||||||
if ( !keepInputFiles ) {
|
|
||||||
IntNative retVal = remove ( inName );
|
|
||||||
@@ -1544,7 +1565,7 @@
|
|
||||||
/*--- If there was an I/O error, we won't get here. ---*/
|
|
||||||
if ( magicNumberOK ) {
|
|
||||||
if ( srcMode == SM_F2F ) {
|
|
||||||
- applySavedMetaInfoToOutputFile ( outName );
|
|
||||||
+ applySavedTimeInfoToOutputFile ( outName );
|
|
||||||
deleteOutputOnInterrupt = False;
|
|
||||||
if ( !keepInputFiles ) {
|
|
||||||
IntNative retVal = remove ( inName );
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
|||||||
Fix for CAN-2005-1848 borrowed from gentoo / debian
|
|
||||||
--- client.c.orig 2005-07-10 10:16:43.000000000 +0100
|
|
||||||
+++ client.c 2005-07-10 10:22:31.000000000 +0100
|
|
||||||
@@ -129,6 +129,8 @@
|
|
||||||
default:
|
|
||||||
if ( p[1] )
|
|
||||||
{
|
|
||||||
+ if (p + 2 + p[1] >= end)
|
|
||||||
+ goto swend; /* Corrupt packet */
|
|
||||||
if ( DhcpOptions.len[*p] == p[1] )
|
|
||||||
memcpy(DhcpOptions.val[*p],p+2,p[1]);
|
|
||||||
else
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
diff -ruN e2fsprogs-1.34.old/lib/ext2fs/mkjournal.c e2fsprogs-1.34/lib/ext2fs/mkjournal.c
|
|
||||||
--- e2fsprogs-1.34.old/lib/ext2fs/mkjournal.c Sun Feb 3 07:03:43 2002
|
|
||||||
+++ e2fsprogs-1.34/lib/ext2fs/mkjournal.c Fri Dec 12 11:20:53 2003
|
|
||||||
@@ -312,11 +312,7 @@
|
|
||||||
ext2_ino_t journal_ino;
|
|
||||||
struct stat st;
|
|
||||||
char jfile[1024];
|
|
||||||
- int fd, mount_flags, f;
|
|
||||||
-
|
|
||||||
- if ((retval = ext2fs_check_mount_point(fs->device_name, &mount_flags,
|
|
||||||
- jfile, sizeof(jfile)-10)))
|
|
||||||
- return retval;
|
|
||||||
+ int fd, mount_flags=0, f;
|
|
||||||
|
|
||||||
if (mount_flags & EXT2_MF_MOUNTED) {
|
|
||||||
strcat(jfile, "/.journal");
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
# patch found at http://freiburg.linux.de/~zeisberg/howtos/fritzcarddsl.html
|
|
||||||
diff -u -r fritz.old/src.drv/driver.c fritz/src.drv/driver.c
|
|
||||||
--- fritz.old/src.drv/driver.c Tue Jul 8 00:02:00 2003
|
|
||||||
+++ fritz/src.drv/driver.c Fri Nov 7 14:21:49 2003
|
|
||||||
@@ -18,6 +18,10 @@
|
|
||||||
* http://www.opensource.org/licenses/lgpl-license.html
|
|
||||||
*
|
|
||||||
* Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de
|
|
||||||
+ *
|
|
||||||
+ * Mon Oct 20 22:43:31 2003
|
|
||||||
+ * Modified by Joerg Lehrke to improve locking
|
|
||||||
+ *
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/io.h>
|
|
||||||
@@ -57,6 +61,8 @@
|
|
||||||
#include "dbgif.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#undef SINGLE_LOCK
|
|
||||||
+
|
|
||||||
#if defined (LOG_MESSAGES)
|
|
||||||
# define mlog log
|
|
||||||
#else
|
|
||||||
@@ -107,7 +113,11 @@
|
|
||||||
struct capi_ctr * capi_controller[2] = { NULL, NULL } ;
|
|
||||||
static bundle_t ctrl_context[2];
|
|
||||||
static per_ctrl_t ctrl_params[2];
|
|
||||||
+#if defined (SINGLE_LOCK)
|
|
||||||
+# define stack_lock qt_lock
|
|
||||||
+#else
|
|
||||||
static spinlock_t stack_lock = SPIN_LOCK_UNLOCKED;
|
|
||||||
+#endif
|
|
||||||
static atomic_t rx_flag = ATOMIC_INIT (0);
|
|
||||||
static atomic_t tx_flag = ATOMIC_INIT (0);
|
|
||||||
static unsigned long qt_flags;
|
|
||||||
@@ -1080,7 +1090,7 @@
|
|
||||||
} /* remove_ctrl */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
-\*-L-------------------------------------------------------------------------*/
|
|
||||||
+\*---------------------------------------------------------------------------*/
|
|
||||||
void lock (void) {
|
|
||||||
unsigned long local_flags;
|
|
||||||
|
|
||||||
@@ -1098,7 +1108,7 @@
|
|
||||||
} /* unlock */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
-\*-C-------------------------------------------------------------------------*/
|
|
||||||
+\*---------------------------------------------------------------------------*/
|
|
||||||
static inline int in_critical (void) {
|
|
||||||
|
|
||||||
return (0 < atomic_read (&crit_count));
|
|
||||||
@@ -1108,17 +1118,16 @@
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static inline void check (void) {
|
|
||||||
unsigned long flags;
|
|
||||||
- spinlock_t chk_lock = SPIN_LOCK_UNLOCKED;
|
|
||||||
|
|
||||||
if (atomic_xchg (&rx_flag, 0)) {
|
|
||||||
- spin_lock_irqsave (&chk_lock, flags);
|
|
||||||
+ spin_lock_irqsave (&stack_lock, flags);
|
|
||||||
rx_handler (capi_card);
|
|
||||||
- spin_unlock_irqrestore (&chk_lock, flags);
|
|
||||||
+ spin_unlock_irqrestore (&stack_lock, flags);
|
|
||||||
}
|
|
||||||
if (atomic_xchg (&tx_flag, 0)) {
|
|
||||||
- spin_lock_irqsave (&chk_lock, flags);
|
|
||||||
+ spin_lock_irqsave (&stack_lock, flags);
|
|
||||||
tx_handler (capi_card);
|
|
||||||
- spin_unlock_irqrestore (&chk_lock, flags);
|
|
||||||
+ spin_unlock_irqrestore (&stack_lock, flags);
|
|
||||||
}
|
|
||||||
} /* check */
|
|
||||||
|
|
||||||
@@ -1640,7 +1649,7 @@
|
|
||||||
return ncci_data_buffer (capi_card->appls, appp, ncci, handle);
|
|
||||||
} /* data_block */
|
|
||||||
|
|
||||||
-/*-S-------------------------------------------------------------------------*\
|
|
||||||
+/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static void scheduler_control (unsigned ena) {
|
|
||||||
int enabled = (int) ena;
|
|
||||||
@@ -1662,6 +1671,7 @@
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static int sched_thread (void * arg) {
|
|
||||||
+ unsigned long flags;
|
|
||||||
|
|
||||||
UNUSED_ARG (arg);
|
|
||||||
daemonize ();
|
|
||||||
@@ -1692,6 +1702,7 @@
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Body of thread, invoke scheduler */
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
if (spin_trylock (&stack_lock)) {
|
|
||||||
os_timer_poll ();
|
|
||||||
assert (capi_lib->cm_schedule);
|
|
||||||
@@ -1700,6 +1711,7 @@
|
|
||||||
}
|
|
||||||
spin_unlock (&stack_lock);
|
|
||||||
}
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
log ("Scheduler thread stopped.\n");
|
|
||||||
up (&hotplug);
|
|
||||||
@@ -1802,17 +1814,22 @@
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static void tx_task (unsigned long data) {
|
|
||||||
-
|
|
||||||
+ unsigned long flags;
|
|
||||||
+
|
|
||||||
UNUSED_ARG (data);
|
|
||||||
if (in_critical ()) {
|
|
||||||
atomic_set (&tx_flag, 1);
|
|
||||||
kick_scheduler ();
|
|
||||||
- } else if (spin_trylock (&stack_lock)) {
|
|
||||||
- tx_handler (capi_card);
|
|
||||||
- spin_unlock (&stack_lock);
|
|
||||||
} else {
|
|
||||||
- atomic_set (&tx_flag, 1);
|
|
||||||
- kick_scheduler ();
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
+ if (spin_trylock (&stack_lock)) {
|
|
||||||
+ tx_handler (capi_card);
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
+ } else {
|
|
||||||
+ atomic_set (&tx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ }
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
} /* tx_task */
|
|
||||||
|
|
||||||
@@ -1865,17 +1882,22 @@
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static void rx_task (unsigned long data) {
|
|
||||||
+ unsigned long flags;
|
|
||||||
|
|
||||||
UNUSED_ARG (data);
|
|
||||||
if (in_critical ()) {
|
|
||||||
atomic_set (&rx_flag, 1);
|
|
||||||
kick_scheduler ();
|
|
||||||
- } else if (spin_trylock (&stack_lock)) {
|
|
||||||
- rx_handler (capi_card);
|
|
||||||
- spin_unlock (&stack_lock);
|
|
||||||
} else {
|
|
||||||
- atomic_set (&rx_flag, 1);
|
|
||||||
- kick_scheduler ();
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
+ if (spin_trylock (&stack_lock)) {
|
|
||||||
+ rx_handler (capi_card);
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
+ } else {
|
|
||||||
+ atomic_set (&rx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ }
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
} /* rx_task */
|
|
||||||
|
|
||||||
@@ -1894,6 +1916,7 @@
|
|
||||||
if (capi_card != (card_p) args) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
+ spin_lock (&stack_lock);
|
|
||||||
while (0 != ((flags = PEEK (capi_card->io_base + INT_CTL)) & CARD_PCI_INT_ASSERT)) {
|
|
||||||
#if !defined (NDEBUG)
|
|
||||||
++count;
|
|
||||||
@@ -1906,6 +1929,7 @@
|
|
||||||
assert ((PEEK (capi_card->io_base + INT_CTL)
|
|
||||||
& ~(CARD_PCI_INT_ASSERT | CARD_PCI_INT_ISASSERTED)) != 0);
|
|
||||||
if (!atomic_read (&link_open)) {
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tx_flag = PEEK (capi_card->io_base + XFER_TOTM_STATUS) == TM_READY;
|
|
||||||
@@ -1920,6 +1944,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
info (0 == (PEEK (capi_card->io_base + INT_CTL) & CARD_PCI_INT_ASSERT));
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
} /* irq_handler */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
# patch found at http://freiburg.linux.de/~zeisberg/howtos/fritzcarddsl.html
|
|
||||||
--- fritz.old/src.drv/driver.c.orig Sun Dec 7 17:46:27 2003
|
|
||||||
+++ fritz/src.drv/driver.c Wed Dec 17 23:46:53 2003
|
|
||||||
@@ -18,6 +18,11 @@
|
|
||||||
* http://www.opensource.org/licenses/lgpl-license.html
|
|
||||||
*
|
|
||||||
* Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de
|
|
||||||
+ *
|
|
||||||
+ * Sunday Dec 07 18:10 2003
|
|
||||||
+ * Modified by Christian 'greeny' Heckhoff to improve locking
|
|
||||||
+ * based on modifications by Joerg Lehrke for Fritz!Card DSL
|
|
||||||
+ *
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/io.h>
|
|
||||||
@@ -53,6 +58,8 @@
|
|
||||||
#include "devif.h"
|
|
||||||
#include "driver.h"
|
|
||||||
|
|
||||||
+#undef SINGLE_LOCK
|
|
||||||
+
|
|
||||||
#if defined (LOG_MESSAGES)
|
|
||||||
# define mlog log
|
|
||||||
#else
|
|
||||||
@@ -108,7 +115,11 @@
|
|
||||||
static bundle_t ctrl_context[2];
|
|
||||||
static per_ctrl_t ctrl_params[2];
|
|
||||||
static unsigned long qt_flags;
|
|
||||||
+#if defined (SINGLE_LOCK)
|
|
||||||
+# define stack_lock qt_lock
|
|
||||||
+#else
|
|
||||||
static spinlock_t qt_lock = SPIN_LOCK_UNLOCKED;
|
|
||||||
+#endif
|
|
||||||
static atomic_t thread_flag = ATOMIC_INIT (0);
|
|
||||||
static atomic_t thread_capi_flag = ATOMIC_INIT (0);
|
|
||||||
static int thread_pid = -1;
|
|
||||||
@@ -1128,7 +1139,7 @@
|
|
||||||
} /* remove_ctrl */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
-\*-L-------------------------------------------------------------------------*/
|
|
||||||
+\*---------------------------------------------------------------------------*/
|
|
||||||
void lock (void) {
|
|
||||||
unsigned long local_flags;
|
|
||||||
|
|
||||||
@@ -1146,15 +1157,14 @@
|
|
||||||
} /* unlock */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
-\*-C-------------------------------------------------------------------------*/
|
|
||||||
+\*---------------------------------------------------------------------------*/
|
|
||||||
static inline void check (void) {
|
|
||||||
unsigned long flags;
|
|
||||||
- spinlock_t chk_lock = SPIN_LOCK_UNLOCKED;
|
|
||||||
|
|
||||||
if (atomic_xchg (&xfer_flag, 0)) {
|
|
||||||
- spin_lock_irqsave (&chk_lock, flags);
|
|
||||||
+ spin_lock_irqsave (&stack_lock, flags);
|
|
||||||
xfer_handler (capi_card);
|
|
||||||
- spin_unlock_irqrestore (&chk_lock, flags);
|
|
||||||
+ spin_unlock_irqrestore (&stack_lock, flags);
|
|
||||||
}
|
|
||||||
} /* check */
|
|
||||||
|
|
||||||
@@ -1687,9 +1697,10 @@
|
|
||||||
return ncci_data_buffer (capi_card->appls, appp, ncci, handle);
|
|
||||||
} /* data_block */
|
|
||||||
|
|
||||||
-/*-S-------------------------------------------------------------------------*\
|
|
||||||
+/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static int sched_thread (void * arg) {
|
|
||||||
+ unsigned long flags;
|
|
||||||
|
|
||||||
UNUSED_ARG (arg);
|
|
||||||
daemonize ();
|
|
||||||
@@ -1721,6 +1732,7 @@
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Body of thread, invoke scheduler */
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
if (spin_trylock (&stack_lock)) {
|
|
||||||
os_timer_poll ();
|
|
||||||
assert (capi_lib->cm_schedule);
|
|
||||||
@@ -1729,6 +1741,7 @@
|
|
||||||
}
|
|
||||||
spin_unlock (&stack_lock);
|
|
||||||
}
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
log ("Scheduler thread stopped.\n");
|
|
||||||
up (&thread_sync);
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
# patch found at http://freiburg.linux.de/~zeisberg/howtos/fritzcarddsl.html
|
|
||||||
--- fritz.old/src.drv/driver.c.orig 2003-12-19 00:00:00.000000000 +0200
|
|
||||||
+++ fritz/src.drv/driver.c 2004-07-18 17:03:36.000000000 +0200
|
|
||||||
@@ -18,6 +18,14 @@
|
|
||||||
* http://www.opensource.org/licenses/lgpl-license.html
|
|
||||||
*
|
|
||||||
* Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de
|
|
||||||
+ *
|
|
||||||
+ * Sunday Dec 07 18:10 2003
|
|
||||||
+ * Modified by Christian 'greeny' Heckhoff to improve locking
|
|
||||||
+ * based on modifications by Joerg Lehrke for Fritz!Card DSL
|
|
||||||
+ *
|
|
||||||
+ * Saturday Jul 24 2004, Oswin Horvath
|
|
||||||
+ * small modifications to make the patch work for the Fritz!Card SL USB (03.11.94)
|
|
||||||
+ *
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <asm/io.h>
|
|
||||||
@@ -54,6 +62,8 @@
|
|
||||||
#include "devif.h"
|
|
||||||
#include "driver.h"
|
|
||||||
|
|
||||||
+#undef SINGLE_LOCK
|
|
||||||
+
|
|
||||||
#if defined (LOG_MESSAGES)
|
|
||||||
# define mlog log
|
|
||||||
#else
|
|
||||||
@@ -118,7 +128,11 @@
|
|
||||||
static bundle_t ctrl_context[2];
|
|
||||||
static per_ctrl_t ctrl_params[2];
|
|
||||||
static unsigned long qt_flags;
|
|
||||||
+#if defined (SINGLE_LOCK)
|
|
||||||
+# define stack_lock qt_lock
|
|
||||||
+#else
|
|
||||||
static spinlock_t qt_lock = SPIN_LOCK_UNLOCKED;
|
|
||||||
+#endif
|
|
||||||
static atomic_t thread_flag = ATOMIC_INIT (0);
|
|
||||||
static atomic_t thread_capi_flag = ATOMIC_INIT (0);
|
|
||||||
static int thread_pid = -1;
|
|
||||||
@@ -946,7 +960,7 @@
|
|
||||||
} /* fdslusb_remove_ctrl */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
-\*-L-------------------------------------------------------------------------*/
|
|
||||||
+\*---------------------------------------------------------------------------*/
|
|
||||||
void lock (void) {
|
|
||||||
unsigned long local_flags;
|
|
||||||
|
|
||||||
@@ -966,12 +980,17 @@
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*-C-------------------------------------------------------------------------*/
|
|
||||||
static inline void check (void) {
|
|
||||||
+ unsigned long flags;
|
|
||||||
|
|
||||||
if (atomic_read (&rx_flag) > 0) {
|
|
||||||
+ spin_lock_irqsave (&stack_lock, flags);
|
|
||||||
rx_handler (fcslusb_capi_card);
|
|
||||||
+ spin_unlock_irqrestore (&stack_lock, flags);
|
|
||||||
}
|
|
||||||
if (atomic_read (&tx_flag) > 0) {
|
|
||||||
+ spin_lock_irqsave (&stack_lock, flags);
|
|
||||||
tx_handler (fcslusb_capi_card);
|
|
||||||
+ spin_unlock_irqrestore (&stack_lock, flags);
|
|
||||||
}
|
|
||||||
} /* check */
|
|
||||||
|
|
||||||
@@ -1519,6 +1538,7 @@
|
|
||||||
/*-S-------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static int scheduler (void * arg) {
|
|
||||||
+ unsigned long flags;
|
|
||||||
|
|
||||||
UNUSED_ARG (arg);
|
|
||||||
daemonize ();
|
|
||||||
@@ -1551,6 +1571,7 @@
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* Body of thread, invoke scheduler */
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
if (spin_trylock (&stack_lock)) {
|
|
||||||
info (!atomic_xchg (&in_scheduler, 1));
|
|
||||||
os_timer_poll ();
|
|
||||||
@@ -1561,6 +1582,7 @@
|
|
||||||
debug (atomic_set (&in_scheduler, 0));
|
|
||||||
spin_unlock (&stack_lock);
|
|
||||||
}
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
log ("Scheduler thread stopped.\n");
|
|
||||||
up (&thread_sync);
|
|
||||||
@@ -1743,22 +1765,43 @@
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static void tx_task (unsigned long data) {
|
|
||||||
-
|
|
||||||
+ unsigned long flags;
|
|
||||||
UNUSED_ARG (data);
|
|
||||||
- if (!in_critical () && spin_trylock (&stack_lock)) {
|
|
||||||
- tx_handler (fcslusb_capi_card);
|
|
||||||
- spin_unlock (&stack_lock);
|
|
||||||
+
|
|
||||||
+ if (in_critical ()){
|
|
||||||
+ atomic_set (&tx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ } else {
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
+ if (spin_trylock (&stack_lock)) {
|
|
||||||
+ tx_handler (fcslusb_capi_card);
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
+ } else {
|
|
||||||
+ atomic_set (&tx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ }
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
} /* tx_task */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
static void rx_task (unsigned long data) {
|
|
||||||
-
|
|
||||||
+ unsigned long flags;
|
|
||||||
UNUSED_ARG (data);
|
|
||||||
- if (!in_critical () && spin_trylock (&stack_lock)) {
|
|
||||||
- rx_handler (fcslusb_capi_card);
|
|
||||||
- spin_unlock (&stack_lock);
|
|
||||||
+ if (in_critical ()){
|
|
||||||
+ atomic_set (&rx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ } else {
|
|
||||||
+ local_irq_save(flags);
|
|
||||||
+ if (spin_trylock (&stack_lock)) {
|
|
||||||
+ rx_handler (fcslusb_capi_card);
|
|
||||||
+ spin_unlock (&stack_lock);
|
|
||||||
+ } else {
|
|
||||||
+ atomic_set (&rx_flag, 1);
|
|
||||||
+ kick_scheduler ();
|
|
||||||
+ }
|
|
||||||
+ local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
} /* rx_task */
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- fritz/src.drv/defs.h.old Thu Sep 25 23:00:00 2003
|
|
||||||
+++ fritz/src.drv/defs.h Tue Oct 12 22:30:54 2004
|
|
||||||
@@ -81,7 +81,7 @@
|
|
||||||
# define KFREE_SKB(x) dev_kfree_skb_any(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
|
|
||||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
|
|
||||||
typedef void irqreturn_t;
|
|
||||||
|
|
||||||
#define IRQ_NONE
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- src.drv/defs.h~ 2006-05-18 16:18:08.525808536 +0200
|
|
||||||
+++ src.drv/defs.h 2006-05-18 18:57:07.000000000 +0200
|
|
||||||
@@ -85,7 +85,7 @@
|
|
||||||
#define CONFIG_ISAPNP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
|
|
||||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 23)
|
|
||||||
typedef void irqreturn_t;
|
|
||||||
|
|
||||||
#define IRQ_NONE
|
|
||||||
@@ -1,321 +0,0 @@
|
|||||||
diff -ur gcc-2.95.3.old/gcc/config/alpha/crtbegin.asm gcc-2.95.3/gcc/config/alpha/crtbegin.asm
|
|
||||||
--- gcc-2.95.3.old/gcc/config/alpha/crtbegin.asm 2004-02-02 12:13:24.000000000 +0000
|
|
||||||
+++ gcc-2.95.3/gcc/config/alpha/crtbegin.asm 2004-02-02 12:16:37.000000000 +0000
|
|
||||||
@@ -1,42 +1,46 @@
|
|
||||||
- # Copyright (C) 1996, 1998 Free Software Foundation, Inc.
|
|
||||||
- # Contributed by Richard Henderson (rth@tamu.edu)
|
|
||||||
- #
|
|
||||||
- # This file 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, or (at your option) any
|
|
||||||
- # later version.
|
|
||||||
- #
|
|
||||||
- # In addition to the permissions in the GNU General Public License, the
|
|
||||||
- # Free Software Foundation gives you unlimited permission to link the
|
|
||||||
- # compiled version of this file with other programs, and to distribute
|
|
||||||
- # those programs without any restriction coming from the use of this
|
|
||||||
- # file. (The General Public License restrictions do apply in other
|
|
||||||
- # respects; for example, they cover modification of the file, and
|
|
||||||
- # distribution when not linked into another program.)
|
|
||||||
- #
|
|
||||||
- # This file is distributed in the hope that it will be useful, but
|
|
||||||
- # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
- # General Public License for more details.
|
|
||||||
- #
|
|
||||||
- # You should have received a copy of the GNU General Public License
|
|
||||||
- # along with this program; see the file COPYING. If not, write to
|
|
||||||
- # the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
||||||
- # Boston, MA 02111-1307, USA.
|
|
||||||
- #
|
|
||||||
- # As a special exception, if you link this library with files
|
|
||||||
- # compiled with GCC to produce an executable, this does not cause
|
|
||||||
- # the resulting executable to be covered by the GNU General Public License.
|
|
||||||
- # This exception does not however invalidate any other reasons why
|
|
||||||
- # the executable file might be covered by the GNU General Public License.
|
|
||||||
-
|
|
||||||
- #
|
|
||||||
- # Heads of the constructor/destructor lists.
|
|
||||||
- #
|
|
||||||
-
|
|
||||||
- # The __*TOR_LIST__ symbols are not global because when this file is used
|
|
||||||
- # in a shared library, we do not want the symbol to fall over to the
|
|
||||||
- # application's lists.
|
|
||||||
+/* Copyright (C) 1996, 1998 Free Software Foundation, Inc.
|
|
||||||
+ * Contributed by Richard Henderson (rth@tamu.edu)
|
|
||||||
+ *
|
|
||||||
+ * This file 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, or (at your option) any
|
|
||||||
+ * later version.
|
|
||||||
+ *
|
|
||||||
+ * In addition to the permissions in the GNU General Public License, the
|
|
||||||
+ * Free Software Foundation gives you unlimited permission to link the
|
|
||||||
+ * compiled version of this file with other programs, and to distribute
|
|
||||||
+ * those programs without any restriction coming from the use of this
|
|
||||||
+ * file. (The General Public License restrictions do apply in other
|
|
||||||
+ * respects; for example, they cover modification of the file, and
|
|
||||||
+ * distribution when not linked into another program.)
|
|
||||||
+ *
|
|
||||||
+ * This file is distributed in the hope that it will be useful, but
|
|
||||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
+ * General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License
|
|
||||||
+ * along with this program; see the file COPYING. If not, write to
|
|
||||||
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
||||||
+ * Boston, MA 02111-1307, USA.
|
|
||||||
+ *
|
|
||||||
+ * As a special exception, if you link this library with files
|
|
||||||
+ * compiled with GCC to produce an executable, this does not cause
|
|
||||||
+ * the resulting executable to be covered by the GNU General Public License.
|
|
||||||
+ * This exception does not however invalidate any other reasons why
|
|
||||||
+ * the executable file might be covered by the GNU General Public License.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include "auto-host.h"
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Heads of the constructor/destructor lists.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+/* The __*TOR_LIST__ symbols are not global because when this file is used
|
|
||||||
+ * in a shared library, we do not want the symbol to fall over to the
|
|
||||||
+ * application's lists.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
.section .ctors,"aw"
|
|
||||||
|
|
||||||
@@ -53,34 +57,34 @@
|
|
||||||
.section .eh_frame,"aw"
|
|
||||||
__EH_FRAME_BEGIN__:
|
|
||||||
|
|
||||||
- #
|
|
||||||
- # Fragment of the ELF _fini routine that invokes our dtor cleanup.
|
|
||||||
- #
|
|
||||||
+/*
|
|
||||||
+ * Fragment of the ELF _fini routine that invokes our dtor cleanup.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
.section .fini,"ax"
|
|
||||||
|
|
||||||
- # Since the bits of the _fini function are spread across many
|
|
||||||
- # object files, each potentially with its own GP, we must
|
|
||||||
- # assume we need to load ours. Further, our .fini section
|
|
||||||
- # can easily be more than 4MB away from our .text bits so we
|
|
||||||
- # can't use bsr.
|
|
||||||
+ /* Since the bits of the _fini function are spread across many
|
|
||||||
+ object files, each potentially with its own GP, we must
|
|
||||||
+ assume we need to load ours. Further, our .fini section
|
|
||||||
+ can easily be more than 4MB away from our .text bits so we
|
|
||||||
+ can't use bsr. */
|
|
||||||
|
|
||||||
br $29,1f
|
|
||||||
1: ldgp $29,0($29)
|
|
||||||
jsr $26,__do_global_dtors_aux
|
|
||||||
|
|
||||||
- # Ideally this call would go in crtend.o, except that we can't
|
|
||||||
- # get hold of __EH_FRAME_BEGIN__ there.
|
|
||||||
+ /* Ideally this call would go in crtend.o, except that we can't
|
|
||||||
+ get hold of __EH_FRAME_BEGIN__ there */
|
|
||||||
|
|
||||||
jsr $26,__do_frame_takedown
|
|
||||||
|
|
||||||
- # Must match the alignment we got from crti.o else we get
|
|
||||||
- # zero-filled holes in our _fini function and then SIGILL.
|
|
||||||
+ /* Must match the alignment we got from crti.o else we get
|
|
||||||
+ zero-filled holes in our _fini function and then SIGILL. */
|
|
||||||
.align 3
|
|
||||||
|
|
||||||
- #
|
|
||||||
- # Fragment of the ELF _init routine that sets up the frame info.
|
|
||||||
- #
|
|
||||||
+/*
|
|
||||||
+ * Fragment of the ELF _init routine that sets up the frame info.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
.section .init,"ax"
|
|
||||||
br $29,1f
|
|
||||||
@@ -88,13 +92,13 @@
|
|
||||||
jsr $26,__do_frame_setup
|
|
||||||
.align 3
|
|
||||||
|
|
||||||
- #
|
|
||||||
- # Invoke our destructors in order.
|
|
||||||
- #
|
|
||||||
+/*
|
|
||||||
+ * Invoke our destructors in order.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
.data
|
|
||||||
|
|
||||||
- # Support recursive calls to exit.
|
|
||||||
+/* Support recursive calls to exit. */
|
|
||||||
$ptr: .quad __DTOR_LIST__
|
|
||||||
|
|
||||||
/* A globally unique widget for c++ local destructors to hang off.
|
|
||||||
@@ -128,17 +132,28 @@
|
|
||||||
.ent __do_global_dtors_aux
|
|
||||||
|
|
||||||
__do_global_dtors_aux:
|
|
||||||
+ ldgp $29,0($27)
|
|
||||||
lda $30,-16($30)
|
|
||||||
.frame $30,16,$26,0
|
|
||||||
stq $9,8($30)
|
|
||||||
stq $26,0($30)
|
|
||||||
.mask 0x4000200,-16
|
|
||||||
- .prologue 0
|
|
||||||
+ .prologue 1
|
|
||||||
|
|
||||||
+#ifdef SHARED
|
|
||||||
+ /* Do c++ local destructors. */
|
|
||||||
+ lda $1,__cxa_finalize
|
|
||||||
+ beq $1,2f
|
|
||||||
+ lda $16,__dso_handle
|
|
||||||
+ jsr $26,__cxa_finalize
|
|
||||||
+ ldgp $29,0($26)
|
|
||||||
+2:
|
|
||||||
+#endif
|
|
||||||
lda $9,$ptr
|
|
||||||
br 1f
|
|
||||||
0: stq $1,0($9)
|
|
||||||
jsr $26,($27)
|
|
||||||
+ ldgp $29,0($26)
|
|
||||||
1: ldq $1,0($9)
|
|
||||||
ldq $27,8($1)
|
|
||||||
addq $1,8,$1
|
|
||||||
@@ -151,11 +166,11 @@
|
|
||||||
|
|
||||||
.end __do_global_dtors_aux
|
|
||||||
|
|
||||||
- #
|
|
||||||
- # Install our frame info.
|
|
||||||
- #
|
|
||||||
+/*
|
|
||||||
+ * Install our frame info.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
- # ??? How can we rationally keep this size correct?
|
|
||||||
+/* ??? How can we rationally keep this size correct? */
|
|
||||||
|
|
||||||
.section .bss
|
|
||||||
.type $object,@object
|
|
||||||
@@ -188,9 +203,9 @@
|
|
||||||
|
|
||||||
.end __do_frame_setup
|
|
||||||
|
|
||||||
- #
|
|
||||||
- # Remove our frame info.
|
|
||||||
- #
|
|
||||||
+/*
|
|
||||||
+ * Remove our frame info.
|
|
||||||
+ */
|
|
||||||
|
|
||||||
.align 3
|
|
||||||
.ent __do_frame_takedown
|
|
||||||
@@ -215,3 +230,6 @@
|
|
||||||
|
|
||||||
.weak __register_frame_info
|
|
||||||
.weak __deregister_frame_info
|
|
||||||
+#ifdef SHARED
|
|
||||||
+.weak __cxa_finalize
|
|
||||||
+#endif
|
|
||||||
diff -ur gcc-2.95.3.old/gcc/config/alpha/elf.h gcc-2.95.3/gcc/config/alpha/elf.h
|
|
||||||
--- gcc-2.95.3.old/gcc/config/alpha/elf.h 1999-06-21 21:15:10.000000000 +0100
|
|
||||||
+++ gcc-2.95.3/gcc/config/alpha/elf.h 2004-02-02 12:16:37.000000000 +0000
|
|
||||||
@@ -513,7 +513,7 @@
|
|
||||||
#define STARTFILE_SPEC \
|
|
||||||
"%{!shared: \
|
|
||||||
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\
|
|
||||||
- crti.o%s crtbegin.o%s"
|
|
||||||
+ crti.o%s %{shared:crtbeginS.o%s}%{!shared:crtbegin.o%s}"
|
|
||||||
|
|
||||||
/* Provide a ENDFILE_SPEC appropriate for ELF. Here we tack on the
|
|
||||||
magical crtend.o file which provides part of the support for
|
|
||||||
@@ -522,7 +522,7 @@
|
|
||||||
|
|
||||||
#undef ENDFILE_SPEC
|
|
||||||
#define ENDFILE_SPEC \
|
|
||||||
- "crtend.o%s crtn.o%s"
|
|
||||||
+ "%{shared:crtendS.o%s}%{!shared:crtend.o%s} crtn.o%s"
|
|
||||||
|
|
||||||
/* We support #pragma. */
|
|
||||||
#define HANDLE_SYSV_PRAGMA
|
|
||||||
diff -ur gcc-2.95.3.old/gcc/config/alpha/t-crtbe gcc-2.95.3/gcc/config/alpha/t-crtbe
|
|
||||||
--- gcc-2.95.3.old/gcc/config/alpha/t-crtbe 1998-12-16 21:01:05.000000000 +0000
|
|
||||||
+++ gcc-2.95.3/gcc/config/alpha/t-crtbe 2004-02-02 12:16:37.000000000 +0000
|
|
||||||
@@ -3,7 +3,13 @@
|
|
||||||
|
|
||||||
# Assemble startup files.
|
|
||||||
crtbegin.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
|
|
||||||
- $(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler $(srcdir)/config/alpha/crtbegin.asm
|
|
||||||
+ $(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtbegin.asm
|
|
||||||
|
|
||||||
crtend.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
|
|
||||||
$(GCC_FOR_TARGET) -c -o crtend.o -x assembler $(srcdir)/config/alpha/crtend.asm
|
|
||||||
+
|
|
||||||
+crtbeginS.o: $(srcdir)/config/alpha/crtbegin.asm $(GCC_PASSES)
|
|
||||||
+ $(GCC_FOR_TARGET) -DSHARED -c -o crtbeginS.o -x assembler-with-cpp -I. $(srcdir)/config/alpha/crtbegin.asm
|
|
||||||
+
|
|
||||||
+crtendS.o: $(srcdir)/config/alpha/crtend.asm $(GCC_PASSES)
|
|
||||||
+ $(GCC_FOR_TARGET) -c -o crtendS.o -x assembler -I. $(srcdir)/config/alpha/crtend.asm
|
|
||||||
diff -ur gcc-2.95.3.old/gcc/configure.in gcc-2.95.3/gcc/configure.in
|
|
||||||
--- gcc-2.95.3.old/gcc/configure.in 2004-02-02 12:13:24.000000000 +0000
|
|
||||||
+++ gcc-2.95.3/gcc/configure.in 2004-02-02 12:16:37.000000000 +0000
|
|
||||||
@@ -607,7 +607,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
if test x$enable_threads = xyes; then
|
|
||||||
@@ -618,7 +618,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
if test x$enable_threads = xyes; then
|
|
||||||
@@ -629,7 +629,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
;;
|
|
||||||
--- gcc-2.95.3.old/gcc/configure 2004-02-02 12:13:24.000000000 +0000
|
|
||||||
+++ gcc-2.95.3/gcc/configure 2004-02-02 14:20:41.000000000 +0000
|
|
||||||
@@ -3041,7 +3041,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="t-linux t-linux-gnulibc1 alpha/t-linux alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
if test x$enable_threads = xyes; then
|
|
||||||
@@ -3052,7 +3052,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="t-linux alpha/t-linux alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
if test x$enable_threads = xyes; then
|
|
||||||
@@ -3063,7 +3063,7 @@
|
|
||||||
tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
|
|
||||||
target_cpu_default="MASK_GAS"
|
|
||||||
tmake_file="alpha/t-crtbe alpha/t-ieee"
|
|
||||||
- extra_parts="crtbegin.o crtend.o"
|
|
||||||
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
|
|
||||||
xmake_file=none
|
|
||||||
gas=yes gnu_ld=yes
|
|
||||||
;;
|
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
Submitted By: Robert Connolly <cendres at videotron dot ca> (ashes)
|
|
||||||
Date: 2004-04-24
|
|
||||||
Initial Package Version: 2.3.3
|
|
||||||
Origin: http://www.research.ibm.com/trl/projects/security/ssp/
|
|
||||||
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/sys/stack_protector.c
|
|
||||||
Description: Smashing Stack Protector - This patch adds guard functions to
|
|
||||||
Glibc.
|
|
||||||
|
|
||||||
This patch depends on erandom sysctl from:
|
|
||||||
http://frandom.sourceforge.net/
|
|
||||||
http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt
|
|
||||||
|
|
||||||
Also see:
|
|
||||||
http://www.research.ibm.com/trl/projects/security/ssp/
|
|
||||||
http://www.linuxfromscratch.org/hlfs/
|
|
||||||
http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
|
|
||||||
|
|
||||||
diff -Naur glibc-2.3-20040418.orig/sysdeps/generic/libc-start.c glibc-2.3-20040418.ssp-frandom/sysdeps/generic/libc-start.c
|
|
||||||
--- glibc-2.3-20040418.orig/sysdeps/generic/libc-start.c 2004-03-31 01:46:43.000000000 +0000
|
|
||||||
+++ glibc-2.3-20040418.ssp-frandom/sysdeps/generic/libc-start.c 2004-04-25 07:07:34.000000000 +0000
|
|
||||||
@@ -188,6 +188,8 @@
|
|
||||||
GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ __guard_setup ();
|
|
||||||
+
|
|
||||||
#ifdef HAVE_CLEANUP_JMP_BUF
|
|
||||||
/* Memory for the cancellation buffer. */
|
|
||||||
struct pthread_unwind_buf unwind_buf;
|
|
||||||
diff -Naur glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Dist glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Dist
|
|
||||||
--- glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Dist 2003-09-24 05:04:29.000000000 +0000
|
|
||||||
+++ glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Dist 2004-04-25 07:09:46.000000000 +0000
|
|
||||||
@@ -1,3 +1,4 @@
|
|
||||||
+stack_protector.c
|
|
||||||
bits/initspin.h
|
|
||||||
cmsg_nxthdr.c
|
|
||||||
dl-brk.c
|
|
||||||
diff -Naur glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Makefile glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Makefile
|
|
||||||
--- glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Makefile 2004-04-03 07:45:26.000000000 +0000
|
|
||||||
+++ glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Makefile 2004-04-25 07:10:02.000000000 +0000
|
|
||||||
@@ -1,5 +1,5 @@
|
|
||||||
ifeq ($(subdir),csu)
|
|
||||||
-sysdep_routines += errno-loc
|
|
||||||
+sysdep_routines += errno-loc stack_protector
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(subdir),assert)
|
|
||||||
diff -Naur glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Versions glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Versions
|
|
||||||
--- glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/Versions 2004-03-19 00:13:55.000000000 +0000
|
|
||||||
+++ glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/Versions 2004-04-25 07:08:58.000000000 +0000
|
|
||||||
@@ -108,6 +108,7 @@
|
|
||||||
GLIBC_2.3.2 {
|
|
||||||
# New kernel interfaces.
|
|
||||||
epoll_create; epoll_ctl; epoll_wait;
|
|
||||||
+ __guard; __guard_setup; __stack_smash_handler;
|
|
||||||
}
|
|
||||||
GLIBC_2.3.3 {
|
|
||||||
gnu_dev_major; gnu_dev_minor; gnu_dev_makedev;
|
|
||||||
diff -Naur glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/stack_protector.c glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/stack_protector.c
|
|
||||||
--- glibc-2.3-20040418.orig/sysdeps/unix/sysv/linux/stack_protector.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ glibc-2.3-20040418.ssp-frandom/sysdeps/unix/sysv/linux/stack_protector.c 2004-04-25 07:24:27.000000000 +0000
|
|
||||||
@@ -0,0 +1,160 @@
|
|
||||||
+/* $hlfs: ssp.c,v 1.1 2004/04/24 00:00:00 robert Exp $ */
|
|
||||||
+
|
|
||||||
+/* Most of this code was copied from the gcc patch, libgcc2.c hunk, from
|
|
||||||
+ * http://www.trl.ibm.com/projects/security/ssp/
|
|
||||||
+ * And therefore this code is part of gcc.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
|
||||||
+ 2000, 2001, 2002 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+This file is part of GCC.
|
|
||||||
+
|
|
||||||
+GCC 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, or (at your option) any later
|
|
||||||
+version.
|
|
||||||
+
|
|
||||||
+In addition to the permissions in the GNU General Public License, the
|
|
||||||
+Free Software Foundation gives you unlimited permission to link the
|
|
||||||
+compiled version of this file into combinations with other programs,
|
|
||||||
+and to distribute those combinations without any restriction coming
|
|
||||||
+from the use of this file. (The General Public License restrictions
|
|
||||||
+do apply in other respects; for example, they cover modification of
|
|
||||||
+the file, and distribution when not linked into a combine
|
|
||||||
+executable.)
|
|
||||||
+
|
|
||||||
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
+for more details.
|
|
||||||
+
|
|
||||||
+You should have received a copy of the GNU General Public License
|
|
||||||
+along with GCC; see the file COPYING. If not, write to the Free
|
|
||||||
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
+02111-1307, USA. */
|
|
||||||
+
|
|
||||||
+/* Some portions of this code were copied from
|
|
||||||
+ * http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/sys/stack_protector.c
|
|
||||||
+ * And hence a dual license.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
|
|
||||||
+ * All rights reserved.
|
|
||||||
+ *
|
|
||||||
+ * Redistribution and use in source and binary forms, with or without
|
|
||||||
+ * modification, are permitted provided that the following conditions
|
|
||||||
+ * are met:
|
|
||||||
+ * 1. Redistributions of source code must retain the above copyright
|
|
||||||
+ * notice, this list of conditions and the following disclaimer.
|
|
||||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
+ * notice, this list of conditions and the following disclaimer in the
|
|
||||||
+ * documentation and/or other materials provided with the distribution.
|
|
||||||
+ *
|
|
||||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
|
|
||||||
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
+ * POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <stdio.h>
|
|
||||||
+#include <string.h>
|
|
||||||
+#include <fcntl.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <sys/sysctl.h>
|
|
||||||
+
|
|
||||||
+#include <signal.h>
|
|
||||||
+
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+#include <sys/socket.h>
|
|
||||||
+#include <sys/un.h>
|
|
||||||
+
|
|
||||||
+#include <sys/syslog.h>
|
|
||||||
+#ifndef _PATH_LOG
|
|
||||||
+#define _PATH_LOG "/dev/log"
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+long __guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
||||||
+
|
|
||||||
+void __guard_setup (void)
|
|
||||||
+{
|
|
||||||
+ int i, mib[3];
|
|
||||||
+ size_t len;
|
|
||||||
+
|
|
||||||
+ if (__guard[0] != 0)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ /* Random is another depth in Linux, hence an array of 3. */
|
|
||||||
+ mib[0] = CTL_KERN;
|
|
||||||
+ mib[1] = KERN_RANDOM;
|
|
||||||
+ mib[2] = RANDOM_ERANDOM;
|
|
||||||
+
|
|
||||||
+ len = 4;
|
|
||||||
+ for (i = 0; i < sizeof(__guard) / 4; i++) {
|
|
||||||
+ if (sysctl(mib, 3, (char *)&((int *)__guard)[i],
|
|
||||||
+ &len, NULL, 0) == -1)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (i < sizeof(__guard) / 4) {
|
|
||||||
+ /* If sysctl was unsuccessful, use the "terminator canary". */
|
|
||||||
+ ((char *)__guard)[0] = 0; ((char*)__guard)[1] = 0;
|
|
||||||
+ ((char *)__guard)[2] = '\n'; ((char *)__guard)[3] = 255;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void __stack_smash_handler (char func[], int damaged)
|
|
||||||
+{
|
|
||||||
+ extern char * __progname;
|
|
||||||
+ const char message[] = ": stack smashing attack in function ";
|
|
||||||
+ int bufsz = 512, len;
|
|
||||||
+ char buf[bufsz];
|
|
||||||
+ int LogFile;
|
|
||||||
+ struct sockaddr_un SyslogAddr; /* AF_UNIX address of local logger */
|
|
||||||
+
|
|
||||||
+ sigset_t mask;
|
|
||||||
+ sigfillset(&mask);
|
|
||||||
+ sigdelset(&mask, SIGABRT); /* Block all signal handlers */
|
|
||||||
+ sigprocmask(SIG_BLOCK, &mask, NULL); /* except SIGABRT */
|
|
||||||
+
|
|
||||||
+ strcpy(buf, "<2>"); len=3; /* send LOG_CRIT */
|
|
||||||
+ strncat(buf, __progname, bufsz-len-1); len = strlen(buf);
|
|
||||||
+ if (bufsz>len) {strncat(buf, message, bufsz-len-1); len = strlen(buf);}
|
|
||||||
+ if (bufsz>len) {strncat(buf, func, bufsz-len-1); len = strlen(buf);}
|
|
||||||
+ /* print error message */
|
|
||||||
+ write (STDERR_FILENO, buf+3, len-3);
|
|
||||||
+ if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) != -1) {
|
|
||||||
+ /*
|
|
||||||
+ * Send "found" message to the "/dev/log" path
|
|
||||||
+ */
|
|
||||||
+ SyslogAddr.sun_family = AF_UNIX;
|
|
||||||
+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
|
|
||||||
+ sizeof(SyslogAddr.sun_path) - 1);
|
|
||||||
+ SyslogAddr.sun_path[sizeof(SyslogAddr.sun_path) - 1] = '\0';
|
|
||||||
+ sendto(LogFile, buf, len, 0, (struct sockaddr *)&SyslogAddr,
|
|
||||||
+ sizeof(SyslogAddr));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Make sure the default handler is associated with SIGABRT */
|
|
||||||
+ struct sigaction sa;
|
|
||||||
+
|
|
||||||
+ memset(&sa, 0, sizeof(struct sigaction));
|
|
||||||
+ sigfillset(&sa.sa_mask); /* Block all signals */
|
|
||||||
+ sa.sa_flags = 0;
|
|
||||||
+ sa.sa_handler = SIG_DFL;
|
|
||||||
+ sigaction(SIGABRT, &sa, NULL);
|
|
||||||
+
|
|
||||||
+ (void)kill(getpid(), SIGABRT);
|
|
||||||
+
|
|
||||||
+ _exit(127);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
@@ -1,892 +0,0 @@
|
|||||||
Submitted By: Jim Gifford <jim@linuxfromscratch.org>
|
|
||||||
Date: 05-28-2006
|
|
||||||
Initial Package Version: 0.97
|
|
||||||
Upstream Status: Unknown
|
|
||||||
Origin: Fedora and Mandriva
|
|
||||||
Description: This patch fixes issues with disk geometry not being
|
|
||||||
detected properly. Part of this patch also fixes
|
|
||||||
gcc 4 compile errors, which are a part of the issue.
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/configure grub-0.97/configure
|
|
||||||
--- grub-0.97.orig/configure 2005-05-07 19:48:12.000000000 -0700
|
|
||||||
+++ grub-0.97/configure 2006-05-28 20:29:36.025466751 -0700
|
|
||||||
@@ -3485,9 +3485,9 @@
|
|
||||||
echo "$as_me:$LINENO: result: $size_flag" >&5
|
|
||||||
echo "${ECHO_T}$size_flag" >&6
|
|
||||||
if test "x$size_flag" = xyes; then
|
|
||||||
- STAGE2_CFLAGS="-Os"
|
|
||||||
+ STAGE2_CFLAGS="-Os -fno-strict-aliasing"
|
|
||||||
else
|
|
||||||
- STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
|
|
||||||
+ STAGE2_CFLAGS="-O2 -fno-strict-aliasing -fno-strength-reduce -fno-unroll-loops"
|
|
||||||
fi
|
|
||||||
# OpenBSD has a GCC extension for protecting applications from
|
|
||||||
# stack smashing attacks, but GRUB doesn't want this feature.
|
|
||||||
diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac
|
|
||||||
--- grub-0.97.orig/configure.ac 2005-05-07 19:36:03.000000000 -0700
|
|
||||||
+++ grub-0.97/configure.ac 2006-05-28 20:28:41.538819726 -0700
|
|
||||||
@@ -93,9 +93,9 @@
|
|
||||||
CFLAGS=$saved_CFLAGS
|
|
||||||
])
|
|
||||||
if test "x$size_flag" = xyes; then
|
|
||||||
- STAGE2_CFLAGS="-Os"
|
|
||||||
+ STAGE2_CFLAGS="-Os -fno-strict-aliasing"
|
|
||||||
else
|
|
||||||
- STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
|
|
||||||
+ STAGE2_CFLAGS="-O2 -fno-strict-aliasing -fno-strength-reduce -fno-unroll-loops"
|
|
||||||
fi
|
|
||||||
# OpenBSD has a GCC extension for protecting applications from
|
|
||||||
# stack smashing attacks, but GRUB doesn't want this feature.
|
|
||||||
diff -Naur grub-0.97.orig/lib/device.c grub-0.97/lib/device.c
|
|
||||||
--- grub-0.97.orig/lib/device.c 2005-03-27 15:14:25.000000000 -0800
|
|
||||||
+++ grub-0.97/lib/device.c 2006-05-28 20:34:03.546804777 -0700
|
|
||||||
@@ -131,6 +131,152 @@
|
|
||||||
#include <shared.h>
|
|
||||||
#include <device.h>
|
|
||||||
|
|
||||||
+#if defined(__linux__)
|
|
||||||
+/* The 2.6 kernel has removed all of the geometry handling for IDE drives
|
|
||||||
+ * that did fixups for LBA, etc. This means that the geometry we get
|
|
||||||
+ * with the ioctl has a good chance of being wrong. So, we get to
|
|
||||||
+ * also know about partition tables and try to read what the geometry
|
|
||||||
+ * is there. *grumble* Very closely based on code from cfdisk
|
|
||||||
+ */
|
|
||||||
+static void get_kernel_geometry(int fd, long long *cyl, int *heads, int *sectors) {
|
|
||||||
+ struct hd_geometry hdg;
|
|
||||||
+
|
|
||||||
+ if (ioctl (fd, HDIO_GETGEO, &hdg))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ *cyl = hdg.cylinders;
|
|
||||||
+ *heads = hdg.heads;
|
|
||||||
+ *sectors = hdg.sectors;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+struct partition {
|
|
||||||
+ unsigned char boot_ind; /* 0x80 - active */
|
|
||||||
+ unsigned char head; /* starting head */
|
|
||||||
+ unsigned char sector; /* starting sector */
|
|
||||||
+ unsigned char cyl; /* starting cylinder */
|
|
||||||
+ unsigned char sys_ind; /* What partition type */
|
|
||||||
+ unsigned char end_head; /* end head */
|
|
||||||
+ unsigned char end_sector; /* end sector */
|
|
||||||
+ unsigned char end_cyl; /* end cylinder */
|
|
||||||
+ unsigned char start4[4]; /* starting sector counting from 0 */
|
|
||||||
+ unsigned char size4[4]; /* nr of sectors in partition */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#define ALIGNMENT 2
|
|
||||||
+typedef union {
|
|
||||||
+ struct {
|
|
||||||
+ unsigned char align[ALIGNMENT];
|
|
||||||
+ unsigned char b[SECTOR_SIZE];
|
|
||||||
+ } c;
|
|
||||||
+ struct {
|
|
||||||
+ unsigned char align[ALIGNMENT];
|
|
||||||
+ unsigned char buffer[0x1BE];
|
|
||||||
+ struct partition part[4];
|
|
||||||
+ unsigned char magicflag[2];
|
|
||||||
+ } p;
|
|
||||||
+} partition_table;
|
|
||||||
+
|
|
||||||
+#define PART_TABLE_FLAG0 0x55
|
|
||||||
+#define PART_TABLE_FLAG1 0xAA
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+get_partition_table_geometry(partition_table *bufp, long long *cyl, int *heads,
|
|
||||||
+ int *sectors) {
|
|
||||||
+ struct partition *p;
|
|
||||||
+ int i,h,s,hh,ss;
|
|
||||||
+ int first = 1;
|
|
||||||
+ int bad = 0;
|
|
||||||
+
|
|
||||||
+ if (bufp->p.magicflag[0] != PART_TABLE_FLAG0 ||
|
|
||||||
+ bufp->p.magicflag[1] != PART_TABLE_FLAG1) {
|
|
||||||
+ /* Matthew Wilcox: slightly friendlier version of
|
|
||||||
+ fatal(_("Bad signature on partition table"), 3);
|
|
||||||
+ */
|
|
||||||
+ fprintf(stderr, "Unknown partition table signature\n");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ hh = ss = 0;
|
|
||||||
+ for (i=0; i<4; i++) {
|
|
||||||
+ p = &(bufp->p.part[i]);
|
|
||||||
+ if (p->sys_ind != 0) {
|
|
||||||
+ h = p->end_head + 1;
|
|
||||||
+ s = (p->end_sector & 077);
|
|
||||||
+ if (first) {
|
|
||||||
+ hh = h;
|
|
||||||
+ ss = s;
|
|
||||||
+ first = 0;
|
|
||||||
+ } else if (hh != h || ss != s)
|
|
||||||
+ bad = 1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!first && !bad) {
|
|
||||||
+ *heads = hh;
|
|
||||||
+ *sectors = ss;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static long long my_lseek (unsigned int fd, long long offset,
|
|
||||||
+ unsigned int origin)
|
|
||||||
+{
|
|
||||||
+#if defined(__linux__) && (!defined(__GLIBC__) || \
|
|
||||||
+ ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
|
|
||||||
+ /* Maybe libc doesn't have large file support. */
|
|
||||||
+ loff_t offset, result;
|
|
||||||
+ static int _llseek (uint filedes, ulong hi, ulong lo,
|
|
||||||
+ loff_t *res, uint wh);
|
|
||||||
+ _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
|
|
||||||
+ loff_t *, res, uint, wh);
|
|
||||||
+
|
|
||||||
+ if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET) < 0)
|
|
||||||
+ return (long long) -1;
|
|
||||||
+ return result;
|
|
||||||
+#else
|
|
||||||
+ return lseek(fd, offset, SEEK_SET);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void get_linux_geometry (int fd, struct geometry *geom) {
|
|
||||||
+ long long kern_cyl = 0; int kern_head = 0, kern_sectors = 0;
|
|
||||||
+ long long pt_cyl = 0; int pt_head = 0, pt_sectors = 0;
|
|
||||||
+ partition_table bufp;
|
|
||||||
+ char *buff, *buf_unaligned;
|
|
||||||
+
|
|
||||||
+ buf_unaligned = malloc(sizeof(partition_table) + 4095);
|
|
||||||
+ buff = (char *) (((unsigned long)buf_unaligned + 4096 - 1) &
|
|
||||||
+ (~(4096-1)));
|
|
||||||
+
|
|
||||||
+ get_kernel_geometry(fd, &kern_cyl, &kern_head, &kern_sectors);
|
|
||||||
+
|
|
||||||
+ if (my_lseek (fd, 0*SECTOR_SIZE, SEEK_SET) < 0) {
|
|
||||||
+ fprintf(stderr, "Unable to seek");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (read(fd, buff, SECTOR_SIZE) == SECTOR_SIZE) {
|
|
||||||
+ memcpy(bufp.c.b, buff, SECTOR_SIZE);
|
|
||||||
+ get_partition_table_geometry(&bufp, &pt_cyl, &pt_head, &pt_sectors);
|
|
||||||
+ } else {
|
|
||||||
+ fprintf(stderr, "Unable to read partition table: %s\n", strerror(errno));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (pt_head && pt_sectors) {
|
|
||||||
+ int cyl_size;
|
|
||||||
+
|
|
||||||
+ geom->heads = pt_head;
|
|
||||||
+ geom->sectors = pt_sectors;
|
|
||||||
+ cyl_size = pt_head * pt_sectors;
|
|
||||||
+ geom->cylinders = geom->total_sectors/cyl_size;
|
|
||||||
+ } else {
|
|
||||||
+ geom->heads = kern_head;
|
|
||||||
+ geom->sectors = kern_sectors;
|
|
||||||
+ geom->cylinders = kern_cyl;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* Get the geometry of a drive DRIVE. */
|
|
||||||
void
|
|
||||||
get_drive_geometry (struct geometry *geom, char **map, int drive)
|
|
||||||
@@ -151,21 +297,16 @@
|
|
||||||
#if defined(__linux__)
|
|
||||||
/* Linux */
|
|
||||||
{
|
|
||||||
- struct hd_geometry hdg;
|
|
||||||
unsigned long nr;
|
|
||||||
-
|
|
||||||
- if (ioctl (fd, HDIO_GETGEO, &hdg))
|
|
||||||
- goto fail;
|
|
||||||
|
|
||||||
if (ioctl (fd, BLKGETSIZE, &nr))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
/* Got the geometry, so save it. */
|
|
||||||
- geom->cylinders = hdg.cylinders;
|
|
||||||
- geom->heads = hdg.heads;
|
|
||||||
- geom->sectors = hdg.sectors;
|
|
||||||
geom->total_sectors = nr;
|
|
||||||
-
|
|
||||||
+ get_linux_geometry(fd, geom);
|
|
||||||
+ if (!geom->heads && !geom->cylinders && !geom->sectors)
|
|
||||||
+ goto fail;
|
|
||||||
goto success;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -844,6 +985,7 @@
|
|
||||||
{
|
|
||||||
char dev[PATH_MAX]; /* XXX */
|
|
||||||
int fd;
|
|
||||||
+ off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
|
|
||||||
|
|
||||||
if ((partition & 0x00FF00) != 0x00FF00)
|
|
||||||
{
|
|
||||||
@@ -870,35 +1012,13 @@
|
|
||||||
errnum = ERR_NO_PART;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
-#if defined(__linux__) && (!defined(__GLIBC__) || \
|
|
||||||
- ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
|
|
||||||
- /* Maybe libc doesn't have large file support. */
|
|
||||||
- {
|
|
||||||
- loff_t offset, result;
|
|
||||||
- static int _llseek (uint filedes, ulong hi, ulong lo,
|
|
||||||
- loff_t *res, uint wh);
|
|
||||||
- _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
|
|
||||||
- loff_t *, res, uint, wh);
|
|
||||||
|
|
||||||
- offset = (loff_t) sector * (loff_t) SECTOR_SIZE;
|
|
||||||
- if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
|
|
||||||
- {
|
|
||||||
- errnum = ERR_DEV_VALUES;
|
|
||||||
- return 0;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-#else
|
|
||||||
- {
|
|
||||||
- off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
|
|
||||||
|
|
||||||
- if (lseek (fd, offset, SEEK_SET) != offset)
|
|
||||||
- {
|
|
||||||
- errnum = ERR_DEV_VALUES;
|
|
||||||
- return 0;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-#endif
|
|
||||||
+ if (my_lseek(fd, offset, SEEK_SET) != offset)
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_DEV_VALUES;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE))
|
|
||||||
{
|
|
||||||
diff -Naur grub-0.97.orig/stage2/Makefile.am grub-0.97/stage2/Makefile.am
|
|
||||||
--- grub-0.97.orig/stage2/Makefile.am 2005-02-02 12:37:35.000000000 -0800
|
|
||||||
+++ grub-0.97/stage2/Makefile.am 2006-05-28 20:28:41.590818435 -0700
|
|
||||||
@@ -24,7 +24,8 @@
|
|
||||||
-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
|
|
||||||
-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
|
|
||||||
-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
|
|
||||||
- -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
|
|
||||||
+ -DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 \
|
|
||||||
+ -fno-strict-aliasing
|
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
|
||||||
pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
diff -Naur grub-0.97.orig/stage2/boot.c grub-0.97/stage2/boot.c
|
|
||||||
--- grub-0.97.orig/stage2/boot.c 2004-03-30 03:44:08.000000000 -0800
|
|
||||||
+++ grub-0.97/stage2/boot.c 2006-05-28 20:33:30.123638792 -0700
|
|
||||||
@@ -55,7 +55,7 @@
|
|
||||||
pu;
|
|
||||||
/* presuming that MULTIBOOT_SEARCH is large enough to encompass an
|
|
||||||
executable header */
|
|
||||||
- unsigned char buffer[MULTIBOOT_SEARCH];
|
|
||||||
+ char buffer[MULTIBOOT_SEARCH];
|
|
||||||
|
|
||||||
/* sets the header pointer to point to the beginning of the
|
|
||||||
buffer by default */
|
|
||||||
@@ -98,7 +98,7 @@
|
|
||||||
/* ELF loading supported if multiboot, FreeBSD and NetBSD. */
|
|
||||||
if ((type == KERNEL_TYPE_MULTIBOOT
|
|
||||||
|| pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD
|
|
||||||
- || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0
|
|
||||||
+ || grub_strcmp ((char *) pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0
|
|
||||||
|| suggested_type == KERNEL_TYPE_NETBSD)
|
|
||||||
&& len > sizeof (Elf32_Ehdr)
|
|
||||||
&& BOOTABLE_I386_ELF ((*((Elf32_Ehdr *) buffer))))
|
|
||||||
@@ -824,8 +824,12 @@
|
|
||||||
moveto = (mbi.mem_upper + 0x400) << 10;
|
|
||||||
|
|
||||||
moveto = (moveto - len) & 0xfffff000;
|
|
||||||
+#if 0
|
|
||||||
max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
|
|
||||||
? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
|
|
||||||
+#else
|
|
||||||
+ max_addr = LINUX_INITRD_MAX_ADDRESS;
|
|
||||||
+#endif
|
|
||||||
if (moveto + len >= max_addr)
|
|
||||||
moveto = (max_addr - len) & 0xfffff000;
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/stage2/disk_io.c grub-0.97/stage2/disk_io.c
|
|
||||||
--- grub-0.97.orig/stage2/disk_io.c 2004-05-23 09:35:24.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/disk_io.c 2006-05-28 20:28:41.582818634 -0700
|
|
||||||
@@ -127,12 +127,19 @@
|
|
||||||
int filepos;
|
|
||||||
int filemax;
|
|
||||||
|
|
||||||
-static inline unsigned long
|
|
||||||
-log2 (unsigned long word)
|
|
||||||
+#define log2(n) ffz(~(n))
|
|
||||||
+
|
|
||||||
+/* include/asm-i386/bitops.h */
|
|
||||||
+/*
|
|
||||||
+ * ffz = Find First Zero in word. Undefined if no zero exists,
|
|
||||||
+ * so code should check against ~0UL first..
|
|
||||||
+ */
|
|
||||||
+static __inline__ unsigned long
|
|
||||||
+ffz (unsigned long word)
|
|
||||||
{
|
|
||||||
- asm volatile ("bsfl %1,%0"
|
|
||||||
- : "=r" (word)
|
|
||||||
- : "r" (word));
|
|
||||||
+ __asm__ ("bsfl %1,%0"
|
|
||||||
+: "=r" (word)
|
|
||||||
+: "r" (~word));
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/stage2/freebsd.h grub-0.97/stage2/freebsd.h
|
|
||||||
--- grub-0.97.orig/stage2/freebsd.h 2003-07-09 04:45:52.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/freebsd.h 2006-05-28 20:28:41.582818634 -0700
|
|
||||||
@@ -78,7 +78,7 @@
|
|
||||||
struct bootinfo
|
|
||||||
{
|
|
||||||
unsigned int bi_version;
|
|
||||||
- unsigned char *bi_kernelname;
|
|
||||||
+ char *bi_kernelname;
|
|
||||||
struct nfs_diskless *bi_nfs_diskless;
|
|
||||||
/* End of fields that are always present. */
|
|
||||||
#define bi_endcommon bi_n_bios_used
|
|
||||||
diff -Naur grub-0.97.orig/stage2/fsys_fat.c grub-0.97/stage2/fsys_fat.c
|
|
||||||
--- grub-0.97.orig/stage2/fsys_fat.c 2005-03-15 08:52:00.000000000 -0800
|
|
||||||
+++ grub-0.97/stage2/fsys_fat.c 2006-05-28 20:28:41.582818634 -0700
|
|
||||||
@@ -54,12 +54,19 @@
|
|
||||||
|
|
||||||
#define FAT_CACHE_SIZE 2048
|
|
||||||
|
|
||||||
+#define log2(n) ffz(~(n))
|
|
||||||
+
|
|
||||||
+/* include/asm-i386/bitops.h */
|
|
||||||
+/*
|
|
||||||
+ * ffz = Find First Zero in word. Undefined if no zero exists,
|
|
||||||
+ * so code should check against ~0UL first..
|
|
||||||
+ */
|
|
||||||
static __inline__ unsigned long
|
|
||||||
-log2 (unsigned long word)
|
|
||||||
+ffz (unsigned long word)
|
|
||||||
{
|
|
||||||
__asm__ ("bsfl %1,%0"
|
|
||||||
- : "=r" (word)
|
|
||||||
- : "r" (word));
|
|
||||||
+: "=r" (word)
|
|
||||||
+: "r" (~word));
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/stage2/fsys_iso9660.c grub-0.97/stage2/fsys_iso9660.c
|
|
||||||
--- grub-0.97.orig/stage2/fsys_iso9660.c 2004-05-11 05:11:19.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/fsys_iso9660.c 2006-05-28 20:28:41.582818634 -0700
|
|
||||||
@@ -55,13 +55,19 @@
|
|
||||||
#define RRCONT_BUF ((unsigned char *)(FSYS_BUF + 6144))
|
|
||||||
#define NAME_BUF ((unsigned char *)(FSYS_BUF + 8192))
|
|
||||||
|
|
||||||
+#define log2(n) ffz(~(n))
|
|
||||||
|
|
||||||
-static inline unsigned long
|
|
||||||
-log2 (unsigned long word)
|
|
||||||
+/* include/asm-i386/bitops.h */
|
|
||||||
+/*
|
|
||||||
+ * ffz = Find First Zero in word. Undefined if no zero exists,
|
|
||||||
+ * so code should check against ~0UL first..
|
|
||||||
+ */
|
|
||||||
+static __inline__ unsigned long
|
|
||||||
+ffz (unsigned long word)
|
|
||||||
{
|
|
||||||
- asm volatile ("bsfl %1,%0"
|
|
||||||
- : "=r" (word)
|
|
||||||
- : "r" (word));
|
|
||||||
+ __asm__ ("bsfl %1,%0"
|
|
||||||
+: "=r" (word)
|
|
||||||
+: "r" (~word));
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -120,7 +126,7 @@
|
|
||||||
break;
|
|
||||||
/* check ISO_VD_PRIMARY and ISO_STANDARD_ID */
|
|
||||||
if (PRIMDESC->type.l == ISO_VD_PRIMARY
|
|
||||||
- && !memcmp(PRIMDESC->id, ISO_STANDARD_ID, sizeof(PRIMDESC->id)))
|
|
||||||
+ && !memcmp((char *) PRIMDESC->id, ISO_STANDARD_ID, sizeof(PRIMDESC->id)))
|
|
||||||
{
|
|
||||||
ISO_SUPER->vol_sector = sector;
|
|
||||||
INODE->file_start = 0;
|
|
||||||
@@ -175,7 +181,7 @@
|
|
||||||
for (; idr->length.l > 0;
|
|
||||||
idr = (struct iso_directory_record *)((char *)idr + idr->length.l) )
|
|
||||||
{
|
|
||||||
- const char *name = idr->name;
|
|
||||||
+ const u_int8_t *name = idr->name;
|
|
||||||
unsigned int name_len = idr->name_len.l;
|
|
||||||
|
|
||||||
file_type = (idr->flags.l & 2) ? ISO_DIRECTORY : ISO_REGULAR;
|
|
||||||
@@ -198,7 +204,7 @@
|
|
||||||
rr_len = (idr->length.l - idr->name_len.l
|
|
||||||
- sizeof(struct iso_directory_record)
|
|
||||||
+ sizeof(idr->name));
|
|
||||||
- rr_ptr.ptr = ((unsigned char *)idr + idr->name_len.l
|
|
||||||
+ rr_ptr.ptr = ((char *)idr + idr->name_len.l
|
|
||||||
+ sizeof(struct iso_directory_record)
|
|
||||||
- sizeof(idr->name));
|
|
||||||
if (rr_ptr.i & 1)
|
|
||||||
@@ -331,9 +337,9 @@
|
|
||||||
memcpy(NAME_BUF, name, name_len);
|
|
||||||
name = NAME_BUF;
|
|
||||||
}
|
|
||||||
- rr_ptr.ptr = RRCONT_BUF + ce_ptr->u.ce.offset.l;
|
|
||||||
+ rr_ptr.ptr = (char *) RRCONT_BUF + ce_ptr->u.ce.offset.l;
|
|
||||||
rr_len = ce_ptr->u.ce.size.l;
|
|
||||||
- if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, ISO_SECTOR_SIZE, RRCONT_BUF))
|
|
||||||
+ if (!iso9660_devread(ce_ptr->u.ce.extent.l, 0, ISO_SECTOR_SIZE, (char *) RRCONT_BUF))
|
|
||||||
{
|
|
||||||
errnum = 0; /* this is not fatal. */
|
|
||||||
break;
|
|
||||||
@@ -344,7 +350,7 @@
|
|
||||||
|
|
||||||
filemax = MAXINT;
|
|
||||||
if (name_len >= pathlen
|
|
||||||
- && !memcmp(name, dirname, pathlen))
|
|
||||||
+ && !memcmp((char *) name, dirname, pathlen))
|
|
||||||
{
|
|
||||||
if (dirname[pathlen] == '/' || !print_possibilities)
|
|
||||||
{
|
|
||||||
@@ -381,7 +387,7 @@
|
|
||||||
print_possibilities = -print_possibilities;
|
|
||||||
memcpy(NAME_BUF, name, name_len);
|
|
||||||
NAME_BUF[name_len] = '\0';
|
|
||||||
- print_a_completion (NAME_BUF);
|
|
||||||
+ print_a_completion ((char *) NAME_BUF);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff -Naur grub-0.97.orig/stage2/fsys_reiserfs.c grub-0.97/stage2/fsys_reiserfs.c
|
|
||||||
--- grub-0.97.orig/stage2/fsys_reiserfs.c 2004-02-18 14:09:10.000000000 -0800
|
|
||||||
+++ grub-0.97/stage2/fsys_reiserfs.c 2006-05-28 20:28:41.586818535 -0700
|
|
||||||
@@ -365,13 +365,19 @@
|
|
||||||
#define JOURNAL_START ((__u32 *) (INFO + 1))
|
|
||||||
#define JOURNAL_END ((__u32 *) (FSYS_BUF + FSYS_BUFLEN))
|
|
||||||
|
|
||||||
+#define log2(n) ffz(~(n))
|
|
||||||
|
|
||||||
+/* include/asm-i386/bitops.h */
|
|
||||||
+/*
|
|
||||||
+ * ffz = Find First Zero in word. Undefined if no zero exists,
|
|
||||||
+ * so code should check against ~0UL first..
|
|
||||||
+ */
|
|
||||||
static __inline__ unsigned long
|
|
||||||
-log2 (unsigned long word)
|
|
||||||
+ffz (unsigned long word)
|
|
||||||
{
|
|
||||||
__asm__ ("bsfl %1,%0"
|
|
||||||
- : "=r" (word)
|
|
||||||
- : "r" (word));
|
|
||||||
+: "=r" (word)
|
|
||||||
+: "r" (~word));
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/stage2/fsys_vstafs.c grub-0.97/stage2/fsys_vstafs.c
|
|
||||||
--- grub-0.97.orig/stage2/fsys_vstafs.c 2003-07-09 04:45:53.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/fsys_vstafs.c 2006-05-28 20:28:41.586818535 -0700
|
|
||||||
@@ -186,35 +186,35 @@
|
|
||||||
int
|
|
||||||
vstafs_read (char *addr, int len)
|
|
||||||
{
|
|
||||||
- struct alloc *a;
|
|
||||||
+ struct alloc *b;
|
|
||||||
int size, ret = 0, offset, curr_len = 0;
|
|
||||||
- int curr_ext;
|
|
||||||
+ int curr_exten;
|
|
||||||
char extent;
|
|
||||||
int ext_size;
|
|
||||||
char *curr_pos;
|
|
||||||
|
|
||||||
get_file_info (f_sector);
|
|
||||||
size = FILE_INFO->len-VSTAFS_START_DATA;
|
|
||||||
- a = FILE_INFO->blocks;
|
|
||||||
+ b = FILE_INFO->blocks;
|
|
||||||
|
|
||||||
if (filepos > 0)
|
|
||||||
{
|
|
||||||
- if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA)
|
|
||||||
+ if (filepos < b[0].a_len * 512 - VSTAFS_START_DATA)
|
|
||||||
{
|
|
||||||
offset = filepos + VSTAFS_START_DATA;
|
|
||||||
extent = 0;
|
|
||||||
- curr_len = a[0].a_len * 512 - offset - filepos;
|
|
||||||
+ curr_len = b[0].a_len * 512 - offset - filepos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- ext_size = a[0].a_len * 512 - VSTAFS_START_DATA;
|
|
||||||
+ ext_size = b[0].a_len * 512 - VSTAFS_START_DATA;
|
|
||||||
offset = filepos - ext_size;
|
|
||||||
extent = 1;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
curr_len -= ext_size;
|
|
||||||
offset -= ext_size;
|
|
||||||
- ext_size = a[extent+1].a_len * 512;
|
|
||||||
+ ext_size = b[extent+1].a_len * 512;
|
|
||||||
}
|
|
||||||
while (extent < FILE_INFO->extents && offset>ext_size);
|
|
||||||
}
|
|
||||||
@@ -223,16 +223,16 @@
|
|
||||||
{
|
|
||||||
offset = VSTAFS_START_DATA;
|
|
||||||
extent = 0;
|
|
||||||
- curr_len = a[0].a_len * 512 - offset;
|
|
||||||
+ curr_len = b[0].a_len * 512 - offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
curr_pos = addr;
|
|
||||||
if (curr_len > len)
|
|
||||||
curr_len = len;
|
|
||||||
|
|
||||||
- for (curr_ext=extent;
|
|
||||||
- curr_ext < FILE_INFO->extents;
|
|
||||||
- curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++)
|
|
||||||
+ for (curr_exten = extent;
|
|
||||||
+ curr_exten < FILE_INFO->extents;
|
|
||||||
+ curr_len = b[curr_exten].a_len * 512, curr_pos += curr_len, curr_exten++)
|
|
||||||
{
|
|
||||||
ret += curr_len;
|
|
||||||
size -= curr_len;
|
|
||||||
@@ -242,7 +242,7 @@
|
|
||||||
curr_len += size;
|
|
||||||
}
|
|
||||||
|
|
||||||
- devread (a[curr_ext].a_start,offset, curr_len, curr_pos);
|
|
||||||
+ devread (b[curr_exten].a_start, offset, curr_len, curr_pos);
|
|
||||||
offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -Naur grub-0.97.orig/stage2/fsys_xfs.c grub-0.97/stage2/fsys_xfs.c
|
|
||||||
--- grub-0.97.orig/stage2/fsys_xfs.c 2005-05-07 19:15:55.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/fsys_xfs.c 2006-05-28 20:28:41.586818535 -0700
|
|
||||||
@@ -97,7 +97,7 @@
|
|
||||||
return ino & XFS_INO_MASK(XFS_INO_OFFSET_BITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static inline __const__ xfs_uint16_t
|
|
||||||
+static inline __attribute__((const)) xfs_uint16_t
|
|
||||||
le16 (xfs_uint16_t x)
|
|
||||||
{
|
|
||||||
__asm__("xchgb %b0,%h0" \
|
|
||||||
@@ -106,7 +106,7 @@
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static inline __const__ xfs_uint32_t
|
|
||||||
+static inline __attribute__((const)) xfs_uint32_t
|
|
||||||
le32 (xfs_uint32_t x)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
@@ -122,7 +122,7 @@
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static inline __const__ xfs_uint64_t
|
|
||||||
+static inline __attribute__((const)) xfs_uint64_t
|
|
||||||
le64 (xfs_uint64_t x)
|
|
||||||
{
|
|
||||||
xfs_uint32_t h = x >> 32;
|
|
||||||
@@ -368,7 +368,7 @@
|
|
||||||
default:
|
|
||||||
namelen = sfe->namelen;
|
|
||||||
*ino = sf_ino ((char *)sfe, namelen);
|
|
||||||
- name = sfe->name;
|
|
||||||
+ name = (char *) sfe->name;
|
|
||||||
sfe = (xfs_dir2_sf_entry_t *)
|
|
||||||
((char *)sfe + namelen + 11 - xfs.i8param);
|
|
||||||
}
|
|
||||||
diff -Naur grub-0.97.orig/stage2/gunzip.c grub-0.97/stage2/gunzip.c
|
|
||||||
--- grub-0.97.orig/stage2/gunzip.c 2003-07-09 04:45:53.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/gunzip.c 2006-05-28 20:28:41.586818535 -0700
|
|
||||||
@@ -277,7 +277,7 @@
|
|
||||||
* is a compressed file, and simply mark it as such.
|
|
||||||
*/
|
|
||||||
if (no_decompression
|
|
||||||
- || grub_read (buf, 10) != 10
|
|
||||||
+ || grub_read ((char *) buf, 10) != 10
|
|
||||||
|| ((*((unsigned short *) buf) != GZIP_HDR_LE)
|
|
||||||
&& (*((unsigned short *) buf) != OLD_GZIP_HDR_LE)))
|
|
||||||
{
|
|
||||||
@@ -293,7 +293,7 @@
|
|
||||||
if (buf[2] != DEFLATED
|
|
||||||
|| (buf[3] & UNSUPP_FLAGS)
|
|
||||||
|| ((buf[3] & EXTRA_FIELD)
|
|
||||||
- && (grub_read (buf, 2) != 2
|
|
||||||
+ && (grub_read ((char *) buf, 2) != 2
|
|
||||||
|| bad_field (*((unsigned short *) buf))))
|
|
||||||
|| ((buf[3] & ORIG_NAME) && bad_field (-1))
|
|
||||||
|| ((buf[3] & COMMENT) && bad_field (-1)))
|
|
||||||
@@ -308,7 +308,7 @@
|
|
||||||
|
|
||||||
filepos = filemax - 8;
|
|
||||||
|
|
||||||
- if (grub_read (buf, 8) != 8)
|
|
||||||
+ if (grub_read ((char *) buf, 8) != 8)
|
|
||||||
{
|
|
||||||
if (! errnum)
|
|
||||||
errnum = ERR_BAD_GZIP_HEADER;
|
|
||||||
@@ -485,8 +485,8 @@
|
|
||||||
|
|
||||||
#define INBUFSIZ 0x2000
|
|
||||||
|
|
||||||
-static uch inbuf[INBUFSIZ];
|
|
||||||
-static int bufloc;
|
|
||||||
+static unsigned char inbuf[INBUFSIZ];
|
|
||||||
+static int bufloc;
|
|
||||||
|
|
||||||
static int
|
|
||||||
get_byte (void)
|
|
||||||
@@ -494,7 +494,7 @@
|
|
||||||
if (filepos == gzip_data_offset || bufloc == INBUFSIZ)
|
|
||||||
{
|
|
||||||
bufloc = 0;
|
|
||||||
- grub_read (inbuf, INBUFSIZ);
|
|
||||||
+ grub_read ((char *) inbuf, INBUFSIZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
return inbuf[bufloc++];
|
|
||||||
@@ -925,7 +925,7 @@
|
|
||||||
unsigned m; /* mask for bit lengths table */
|
|
||||||
unsigned n; /* number of lengths to get */
|
|
||||||
unsigned nb; /* number of bit length codes */
|
|
||||||
- unsigned nl; /* number of literal/length codes */
|
|
||||||
+ unsigned nc; /* number of literal/length codes */
|
|
||||||
unsigned nd; /* number of distance codes */
|
|
||||||
unsigned ll[286 + 30]; /* literal/length and distance code lengths */
|
|
||||||
register ulg b; /* bit buffer */
|
|
||||||
@@ -937,7 +937,7 @@
|
|
||||||
|
|
||||||
/* read in table lengths */
|
|
||||||
NEEDBITS (5);
|
|
||||||
- nl = 257 + ((unsigned) b & 0x1f); /* number of literal/length codes */
|
|
||||||
+ nc = 257 + ((unsigned) b & 0x1f); /* number of literal/length codes */
|
|
||||||
DUMPBITS (5);
|
|
||||||
NEEDBITS (5);
|
|
||||||
nd = 1 + ((unsigned) b & 0x1f); /* number of distance codes */
|
|
||||||
@@ -945,7 +945,7 @@
|
|
||||||
NEEDBITS (4);
|
|
||||||
nb = 4 + ((unsigned) b & 0xf); /* number of bit length codes */
|
|
||||||
DUMPBITS (4);
|
|
||||||
- if (nl > 286 || nd > 30)
|
|
||||||
+ if (nc > 286 || nd > 30)
|
|
||||||
{
|
|
||||||
errnum = ERR_BAD_GZIP_DATA;
|
|
||||||
return;
|
|
||||||
@@ -970,7 +970,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read in literal and distance code lengths */
|
|
||||||
- n = nl + nd;
|
|
||||||
+ n = nc + nd;
|
|
||||||
m = mask_bits[bl];
|
|
||||||
i = l = 0;
|
|
||||||
while ((unsigned) i < n)
|
|
||||||
@@ -1034,7 +1034,7 @@
|
|
||||||
|
|
||||||
/* build the decoding tables for literal/length and distance codes */
|
|
||||||
bl = lbits;
|
|
||||||
- if ((i = huft_build (ll, nl, 257, cplens, cplext, &tl, &bl)) != 0)
|
|
||||||
+ if ((i = huft_build (ll, nc, 257, cplens, cplext, &tl, &bl)) != 0)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (i == 1)
|
|
||||||
@@ -1045,7 +1045,7 @@
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bd = dbits;
|
|
||||||
- if ((i = huft_build (ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0)
|
|
||||||
+ if ((i = huft_build (ll + nc, nd, 0, cpdist, cpdext, &td, &bd)) != 0)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (i == 1)
|
|
||||||
diff -Naur grub-0.97.orig/stage2/md5.c grub-0.97/stage2/md5.c
|
|
||||||
--- grub-0.97.orig/stage2/md5.c 2003-07-09 04:45:53.000000000 -0700
|
|
||||||
+++ grub-0.97/stage2/md5.c 2006-05-28 20:28:41.590818435 -0700
|
|
||||||
@@ -166,7 +166,7 @@
|
|
||||||
inputlen -= 64 - buflen;
|
|
||||||
while (inputlen >= 64)
|
|
||||||
{
|
|
||||||
- md5_transform (input);
|
|
||||||
+ md5_transform ((unsigned char *) input);
|
|
||||||
input += 64;
|
|
||||||
inputlen -= 64;
|
|
||||||
}
|
|
||||||
@@ -211,7 +211,7 @@
|
|
||||||
char *p;
|
|
||||||
int saltlen;
|
|
||||||
int i, n;
|
|
||||||
- unsigned char alt_result[16];
|
|
||||||
+ char alt_result[16];
|
|
||||||
unsigned char *digest;
|
|
||||||
|
|
||||||
if (check)
|
|
||||||
diff -Naur grub-0.97.orig/stage2/start_eltorito.S grub-0.97/stage2/start_eltorito.S
|
|
||||||
--- grub-0.97.orig/stage2/start_eltorito.S 2004-03-27 08:14:20.000000000 -0800
|
|
||||||
+++ grub-0.97/stage2/start_eltorito.S 2006-05-28 20:31:17.770936712 -0700
|
|
||||||
@@ -40,9 +40,9 @@
|
|
||||||
#define ABS(x) (x-_start+BOOTSEC_LOCATION)
|
|
||||||
|
|
||||||
#ifdef STAGE1_5
|
|
||||||
-# define STAGE_ADDR 0x2000
|
|
||||||
+# define STAGE_ADDR 0x2200
|
|
||||||
#else
|
|
||||||
-# define STAGE_ADDR 0x8000
|
|
||||||
+# define STAGE_ADDR 0x8200
|
|
||||||
#endif /* STAGE1_5 */
|
|
||||||
|
|
||||||
/* Print message string */
|
|
||||||
@@ -71,12 +71,14 @@
|
|
||||||
. = _start + 8 /* Pad to file offset 8 */
|
|
||||||
|
|
||||||
/* This table gets filled in by mkisofs using the
|
|
||||||
- -boot-info-table option */
|
|
||||||
-bi_pvd: .long 0xDEADBEEF /* LBA of primary volume descript */
|
|
||||||
-bi_file: .long 0xDEADBEEF /* LBA of boot file */
|
|
||||||
-bi_length: .long 0xDEADBEEF /* Length of boot file */
|
|
||||||
-bi_csum: .long 0xDEADBEEF /* Checksum of boot file */
|
|
||||||
-bi_reserved: .space (10*4) /* Reserved */
|
|
||||||
+ -boot-info-table option If not, the values in this
|
|
||||||
+ table are default values that we can use to get us
|
|
||||||
+ what we need, at least under a certain set of assumptions. */
|
|
||||||
+bi_pvd: .long 16 /* LBA of primary volume descript */
|
|
||||||
+bi_file: .long 0 /* LBA of boot file */
|
|
||||||
+bi_length: .long 0xDEADBEEF /* Length of boot file */
|
|
||||||
+bi_csum: .long 0xDEADBEEF /* Checksum of boot file */
|
|
||||||
+bi_reserved: .space (10*4) /* Reserved */
|
|
||||||
|
|
||||||
real_start:
|
|
||||||
xor %ax, %ax
|
|
||||||
@@ -92,10 +94,28 @@
|
|
||||||
/* save drive reference first thing! */
|
|
||||||
mov %dl, ABS(BootDrive)
|
|
||||||
|
|
||||||
- /* print a notification message on the screen */
|
|
||||||
- MSG(notification_string)
|
|
||||||
+ /* check if machine support IBM/MS int 13h extensions */
|
|
||||||
+ mov $0x41, %ah
|
|
||||||
+ mov $0x55AA, %bx
|
|
||||||
+ int $0x13
|
|
||||||
+ jnc load_image
|
|
||||||
+
|
|
||||||
+ /* bios doesn't support int 13h extensions, print error messages */
|
|
||||||
+ MSG(int13_error_string1)
|
|
||||||
+ MSG(notification_done)
|
|
||||||
+ MSG(int13_error_string2)
|
|
||||||
+ MSG(notification_done)
|
|
||||||
+ MSG(int13_error_string3)
|
|
||||||
+ MSG(notification_done)
|
|
||||||
+ /* even when bios says that it doesn't support int 13h
|
|
||||||
+ extensions, do not stop here and try to load image anyway,
|
|
||||||
+ because some bioses says that there isn't support for
|
|
||||||
+ extended functions but have the needed extended read function
|
|
||||||
+ (int 13h, function AH=42h) */
|
|
||||||
|
|
||||||
load_image:
|
|
||||||
+ /* print a notification message on the screen */
|
|
||||||
+ MSG(notification_string)
|
|
||||||
/* Set up boot file sector, size, load address */
|
|
||||||
mov ABS(bi_length), %eax
|
|
||||||
add $(ISO_SECTOR_SIZE-1), %eax
|
|
||||||
@@ -105,6 +125,8 @@
|
|
||||||
mov %bx, %es
|
|
||||||
xor %bx, %bx
|
|
||||||
mov ABS(bi_file), %eax
|
|
||||||
+ inc %eax /* do not reload the first sector (this code) */
|
|
||||||
+ dec %bp /* this way we have more room for code in stage1 */
|
|
||||||
call getlinsec
|
|
||||||
mov %ds, %ax
|
|
||||||
mov %ax, %es
|
|
||||||
@@ -115,7 +137,7 @@
|
|
||||||
mov $ABS(firstlist - BOOTSEC_LISTSIZE), %si
|
|
||||||
mov (%si), %ebp
|
|
||||||
mov ABS(BootDrive), %dl /* this makes sure %dl is our "boot" drive */
|
|
||||||
- ljmp $0, $(STAGE_ADDR+SECTOR_SIZE) /* jump to main() in asm.S */
|
|
||||||
+ ljmp $0, $(STAGE_ADDR) /* jump to main() in asm.S */
|
|
||||||
|
|
||||||
/* go here when you need to stop the machine hard after an error condition */
|
|
||||||
stop: jmp stop
|
|
||||||
@@ -171,11 +193,11 @@
|
|
||||||
*/
|
|
||||||
xint13:
|
|
||||||
movb $6, ABS(RetryCount)
|
|
||||||
- pushal
|
|
||||||
.try:
|
|
||||||
+ pushal
|
|
||||||
int $0x13
|
|
||||||
jc 1f
|
|
||||||
- add $(8*4), %sp /* Clean up stack */
|
|
||||||
+ popal /* Clean up stack */
|
|
||||||
ret
|
|
||||||
1:
|
|
||||||
mov %ah, %dl /* Save error code */
|
|
||||||
@@ -276,6 +298,10 @@
|
|
||||||
|
|
||||||
read_error_string: .string "Read error 0x"
|
|
||||||
|
|
||||||
+int13_error_string1: .string "Support for IBM/MS INT 13h extensions not found"
|
|
||||||
+int13_error_string2: .string "GRUB cannot be loaded if int 13h/function AH=42h isn't present"
|
|
||||||
+int13_error_string3: .string "Trying to load stage 2 anyway..."
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* EBIOS disk address packet
|
|
||||||
*/
|
|
||||||
@@ -306,7 +332,8 @@
|
|
||||||
.word 0
|
|
||||||
.word 0
|
|
||||||
|
|
||||||
- . = _start + SECTOR_SIZE - BOOTSEC_LISTSIZE
|
|
||||||
+ /* size of the code we can place between main body and fixed top location */
|
|
||||||
+ . = _start + 1536 - BOOTSEC_LISTSIZE
|
|
||||||
|
|
||||||
/* fill the first data listing with the default */
|
|
||||||
blocklist_default_start:/* this is the sector start parameter, in logical
|
|
||||||
@@ -321,6 +348,12 @@
|
|
||||||
#endif
|
|
||||||
blocklist_default_seg: /* this is the segment of the starting address
|
|
||||||
to load the data into */
|
|
||||||
- .word (STAGE_ADDR + SECTOR_SIZE) >> 4
|
|
||||||
+ .word (STAGE_ADDR) >> 4
|
|
||||||
|
|
||||||
firstlist: /* this label has to be after the list data!!! */
|
|
||||||
+
|
|
||||||
+ /* this is a workaround to allow more code to be added in stage1,
|
|
||||||
+ it allows more code to be added for this stage, but for this
|
|
||||||
+ we can't reload the first sector. So we have to align the code
|
|
||||||
+ to ISO_SECTOR_SIZE. */
|
|
||||||
+ . = _start + ISO_SECTOR_SIZE
|
|
||||||
diff -Naur grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in
|
|
||||||
--- grub-0.97.orig/util/grub-install.in 2004-07-24 11:57:31.000000000 -0700
|
|
||||||
+++ grub-0.97/util/grub-install.in 2006-05-28 20:30:31.484088268 -0700
|
|
||||||
@@ -336,6 +336,10 @@
|
|
||||||
# Create a safe temporary file.
|
|
||||||
test -n "$mklog" && log_file=`$mklog`
|
|
||||||
|
|
||||||
+ # Before all invocations of the grub shell, call sync to make sure
|
|
||||||
+ # the raw device is in sync with any bufferring in filesystems.
|
|
||||||
+ sync
|
|
||||||
+
|
|
||||||
$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
|
|
||||||
quit
|
|
||||||
EOF
|
|
||||||
@@ -450,6 +454,10 @@
|
|
||||||
# Create a safe temporary file.
|
|
||||||
test -n "$mklog" && log_file=`$mklog`
|
|
||||||
|
|
||||||
+# Before all invocations of the grub shell, call sync to make sure
|
|
||||||
+# the raw device is in sync with any bufferring in filesystems.
|
|
||||||
+sync
|
|
||||||
+
|
|
||||||
# Now perform the installation.
|
|
||||||
$grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
|
|
||||||
root $root_drive
|
|
||||||
@@ -1,604 +0,0 @@
|
|||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/config.h.in grub-0.97-1/config.h.in
|
|
||||||
--- grub-0.97/config.h.in 2005-05-08 06:48:19.000000000 +0400
|
|
||||||
+++ grub-0.97-1/config.h.in 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -27,9 +27,16 @@
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
|
|
||||||
+/* Define to 1 if you have the `aal-minimal' library (-laal-minimal). */
|
|
||||||
+#undef HAVE_LIBAAL_MINIMAL
|
|
||||||
+
|
|
||||||
/* Define if you have a curses library */
|
|
||||||
#undef HAVE_LIBCURSES
|
|
||||||
|
|
||||||
+/* Define to 1 if you have the `reiser4-minimal' library (-lreiser4-minimal).
|
|
||||||
+ */
|
|
||||||
+#undef HAVE_LIBREISER4_MINIMAL
|
|
||||||
+
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#undef HAVE_MEMORY_H
|
|
||||||
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/configure.ac grub-0.97-1/configure.ac
|
|
||||||
--- grub-0.97/configure.ac 2005-05-08 06:36:03.000000000 +0400
|
|
||||||
+++ grub-0.97-1/configure.ac 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -263,6 +263,77 @@ if test x"$enable_reiserfs" != xno; then
|
|
||||||
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
+dnl Checking for reiser4
|
|
||||||
+REISER4_LIBS=""
|
|
||||||
+REISER4_CFLAGS=""
|
|
||||||
+
|
|
||||||
+OLD_LIBS=$LIBS
|
|
||||||
+OLD_CFLAGS=$CFLAGS
|
|
||||||
+LIBS=""
|
|
||||||
+CFLAGS=""
|
|
||||||
+
|
|
||||||
+AC_ARG_ENABLE(reiser4,
|
|
||||||
+ [ --disable-reiser4 disable Reiser4 support in Stage 2])
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ AC_CHECK_LIB(aal-minimal, aal_mem_init, ,
|
|
||||||
+ AC_MSG_WARN(
|
|
||||||
+Reiser4 support is disabled due to inability find libaal-minimal with
|
|
||||||
+memory manager support turned on.)
|
|
||||||
+ enable_reiser4=no
|
|
||||||
+ )
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ AC_CHECK_HEADER(aal/libaal.h, ,
|
|
||||||
+ AC_MSG_WARN(
|
|
||||||
+Libaal header files are not found. Reiser4 support is disabled
|
|
||||||
+ )
|
|
||||||
+ enable_reiser4=no)
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ AC_CHECK_LIB(reiser4-minimal, reiser4_fs_open, ,
|
|
||||||
+ AC_MSG_WARN(
|
|
||||||
+Reiser4 support is disabled due to inability find valid libreiser4-minimal.)
|
|
||||||
+ enable_reiser4=no,
|
|
||||||
+ -laal-minimal
|
|
||||||
+ )
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ AC_CHECK_HEADER(reiser4/libreiser4.h, ,
|
|
||||||
+ AC_MSG_WARN(
|
|
||||||
+Reiser4 header files are not found. Reiser4 support is disabled.
|
|
||||||
+ )
|
|
||||||
+ enable_reiser4=no)
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ REISER4_CFLAGS="$REISER4_CFLAGS -DFSYS_REISER4=1"
|
|
||||||
+ REISER4_LIBS=$LIBS
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ AC_CHECK_LIB(reiser4-minimal, __sym40_plug_init,
|
|
||||||
+ REISER4_CFLAGS="$REISER4_CFLAGS -DENABLE_SYMLINKS=1",
|
|
||||||
+AC_MSG_WARN(Reiser4 symlinks support is disabled.),
|
|
||||||
+ -laal-minimal
|
|
||||||
+ )
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+LIBS=$OLD_LIBS
|
|
||||||
+CFLAGS=$OLD_CFLAGS
|
|
||||||
+
|
|
||||||
+if test x"$enable_reiser4" != xno; then
|
|
||||||
+ enable_reiser4_support=yes
|
|
||||||
+ FSYS_CFLAGS="$FSYS_CFLAGS $REISER4_CFLAGS"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+AC_SUBST(REISER4_LIBS)
|
|
||||||
+AC_SUBST(REISER4_CFLAGS)
|
|
||||||
+AM_CONDITIONAL(ENABLE_REISER4_SUPPORT, test x"$enable_reiser4" != xno)
|
|
||||||
+
|
|
||||||
AC_ARG_ENABLE(vstafs,
|
|
||||||
[ --disable-vstafs disable VSTa FS support in Stage 2])
|
|
||||||
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/docs/grub.texi grub-0.97-1/docs/grub.texi
|
|
||||||
--- grub-0.97/docs/grub.texi 2005-05-08 06:59:59.000000000 +0400
|
|
||||||
+++ grub-0.97-1/docs/grub.texi 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -283,7 +283,7 @@ devices, partitions, and files in a dire
|
|
||||||
Support multiple filesystem types transparently, plus a useful explicit
|
|
||||||
blocklist notation. The currently supported filesystem types are
|
|
||||||
@dfn{BSD FFS}, @dfn{DOS FAT16 and FAT32}, @dfn{Minix fs}, @dfn{Linux
|
|
||||||
-ext2fs}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa
|
|
||||||
+ext2fs}, @dfn{ReiserFS}, @dfn{ReiserFS}, @dfn{JFS}, @dfn{XFS}, and @dfn{VSTa
|
|
||||||
fs}. @xref{Filesystem}, for more information.
|
|
||||||
|
|
||||||
@item Support automatic decompression
|
|
||||||
@@ -1776,6 +1776,7 @@ itself. Usually, this is put in a filesy
|
|
||||||
@itemx jfs_stage1_5
|
|
||||||
@itemx minix_stage1_5
|
|
||||||
@itemx reiserfs_stage1_5
|
|
||||||
+@itemx reiser4_stage1_5
|
|
||||||
@itemx vstafs_stage1_5
|
|
||||||
@itemx xfs_stage1_5
|
|
||||||
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/grub/Makefile.am grub-0.97-1/grub/Makefile.am
|
|
||||||
--- grub-0.97/grub/Makefile.am 2005-02-02 23:38:19.000000000 +0300
|
|
||||||
+++ grub-0.97-1/grub/Makefile.am 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -16,4 +16,4 @@ AM_CPPFLAGS = -DGRUB_UTIL=1 -DFSYS_EXT2F
|
|
||||||
AM_CFLAGS = $(GRUB_CFLAGS)
|
|
||||||
|
|
||||||
grub_SOURCES = main.c asmstub.c
|
|
||||||
-grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)
|
|
||||||
+grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS) $(REISER4_LIBS)
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/INSTALL grub-0.97-1/INSTALL
|
|
||||||
--- grub-0.97/INSTALL 2005-05-08 06:43:15.000000000 +0400
|
|
||||||
+++ grub-0.97-1/INSTALL 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -207,6 +207,9 @@ operates.
|
|
||||||
`--disable-reiserfs'
|
|
||||||
Omit the ReiserFS support in Stage 2.
|
|
||||||
|
|
||||||
+`--disable-reiser4'
|
|
||||||
+ Omit the Reiser4 support in Stage 2.
|
|
||||||
+
|
|
||||||
`--disable-vstafs'
|
|
||||||
Omit the VSTa filesystem support in Stage 2.
|
|
||||||
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/builtins.c grub-0.97-1/stage2/builtins.c
|
|
||||||
--- grub-0.97/stage2/builtins.c 2005-02-16 00:58:23.000000000 +0300
|
|
||||||
+++ grub-0.97-1/stage2/builtins.c 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -3880,6 +3880,7 @@ setup_func (char *arg, int flags)
|
|
||||||
{"jfs", "/jfs_stage1_5"},
|
|
||||||
{"minix", "/minix_stage1_5"},
|
|
||||||
{"reiserfs", "/reiserfs_stage1_5"},
|
|
||||||
+ {"reiser4", "/reiser4_stage1_5"},
|
|
||||||
{"vstafs", "/vstafs_stage1_5"},
|
|
||||||
{"xfs", "/xfs_stage1_5"}
|
|
||||||
};
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/disk_io.c grub-0.97-1/stage2/disk_io.c
|
|
||||||
--- grub-0.97/stage2/disk_io.c 2004-05-23 20:35:24.000000000 +0400
|
|
||||||
+++ grub-0.97-1/stage2/disk_io.c 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -63,6 +63,9 @@ struct fsys_entry fsys_table[NUM_FSYS +
|
|
||||||
# ifdef FSYS_REISERFS
|
|
||||||
{"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
|
|
||||||
# endif
|
|
||||||
+# ifdef FSYS_REISER4
|
|
||||||
+ {"reiser4", reiser4_mount, reiser4_read, reiser4_dir, 0, reiser4_embed},
|
|
||||||
+# endif
|
|
||||||
# ifdef FSYS_VSTAFS
|
|
||||||
{"vstafs", vstafs_mount, vstafs_read, vstafs_dir, 0, 0},
|
|
||||||
# endif
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/filesys.h grub-0.97-1/stage2/filesys.h
|
|
||||||
--- grub-0.97/stage2/filesys.h 2004-05-14 23:36:43.000000000 +0400
|
|
||||||
+++ grub-0.97-1/stage2/filesys.h 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -77,6 +77,16 @@ int reiserfs_embed (int *start_sector, i
|
|
||||||
#define FSYS_REISERFS_NUM 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#ifdef FSYS_REISER4
|
|
||||||
+#define FSYS_REISER4_NUM 1
|
|
||||||
+int reiser4_mount (void);
|
|
||||||
+int reiser4_read (char *buf, int len);
|
|
||||||
+int reiser4_dir (char *dirname);
|
|
||||||
+int reiser4_embed (int *start_sector, int needed_sectors);
|
|
||||||
+#else
|
|
||||||
+#define FSYS_REISER4_NUM 0
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#ifdef FSYS_VSTAFS
|
|
||||||
#define FSYS_VSTAFS_NUM 1
|
|
||||||
int vstafs_mount (void);
|
|
||||||
@@ -127,8 +137,8 @@ int iso9660_dir (char *dirname);
|
|
||||||
#ifndef NUM_FSYS
|
|
||||||
#define NUM_FSYS \
|
|
||||||
(FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \
|
|
||||||
- + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \
|
|
||||||
- + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
|
|
||||||
+ + FSYS_REISERFS_NUM + FSYS_REISER4_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \
|
|
||||||
+ + FSYS_XFS_NUM + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* defines for the block filesystem info area */
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/fsys_reiser4.c grub-0.97-1/stage2/fsys_reiser4.c
|
|
||||||
--- grub-0.97/stage2/fsys_reiser4.c 1970-01-01 03:00:00.000000000 +0300
|
|
||||||
+++ grub-0.97-1/stage2/fsys_reiser4.c 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -0,0 +1,260 @@
|
|
||||||
+/*
|
|
||||||
+ * fsys_reiser4.c -- reiser4 filesystem support.
|
|
||||||
+ * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
|
||||||
+ *
|
|
||||||
+ * GRUB -- GRand Unified Bootloader
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or modify
|
|
||||||
+ * it under the terms of the GNU General Public License as published by
|
|
||||||
+ * the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+ * (at your option) any later version.
|
|
||||||
+ *
|
|
||||||
+ * This program is distributed in the hope that it will be useful,
|
|
||||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+ * GNU General Public License for more details.
|
|
||||||
+ *
|
|
||||||
+ * You should have received a copy of the GNU General Public License
|
|
||||||
+ * along with this program; if not, write to the Free Software
|
|
||||||
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
+*/
|
|
||||||
+
|
|
||||||
+#ifdef FSYS_REISER4
|
|
||||||
+#include "shared.h"
|
|
||||||
+#include "filesys.h"
|
|
||||||
+
|
|
||||||
+#define ENABLE_MINIMAL
|
|
||||||
+#include <reiser4/libreiser4.h>
|
|
||||||
+
|
|
||||||
+static reiser4_fs_t *fs = NULL;
|
|
||||||
+static aal_device_t *dev = NULL;
|
|
||||||
+static reiser4_object_t *object = NULL;
|
|
||||||
+
|
|
||||||
+/* Read callback of grub specific device. It uses devread() for reading passed
|
|
||||||
+ @count of device blocks starting from @blk to passed @buff. */
|
|
||||||
+static errno_t grub_dev_read(aal_device_t *device,
|
|
||||||
+ void *buff, blk_t blk,
|
|
||||||
+ count_t count)
|
|
||||||
+{
|
|
||||||
+ unsigned int size;
|
|
||||||
+ unsigned int factor;
|
|
||||||
+ unsigned int sector;
|
|
||||||
+
|
|
||||||
+ /* Calculating actual sector and size in bytes to be read from
|
|
||||||
+ device. */
|
|
||||||
+ factor = device->blksize / SECTOR_SIZE;
|
|
||||||
+ sector = (unsigned int)blk << aal_log2(factor);
|
|
||||||
+ size = (unsigned int)count * (SECTOR_SIZE * factor);
|
|
||||||
+
|
|
||||||
+ /* Reading from the current device */
|
|
||||||
+ if (!devread(sector, 0, size, buff))
|
|
||||||
+ return -EIO;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Length callback of grub device */
|
|
||||||
+static count_t grub_dev_len(aal_device_t *device) {
|
|
||||||
+ unsigned int factor;
|
|
||||||
+
|
|
||||||
+ /* Getting partition length in device blocks */
|
|
||||||
+ factor = device->blksize / SECTOR_SIZE;
|
|
||||||
+ return (part_length >> aal_log2(factor));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ Initializing grub device abstraction instance. It will use devread and friends
|
|
||||||
+ for providing needed functionality.
|
|
||||||
+*/
|
|
||||||
+struct aal_device_ops grub_dev_ops = {
|
|
||||||
+ .read = grub_dev_read,
|
|
||||||
+ .len = grub_dev_len
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/* Initializes reiser4 */
|
|
||||||
+static int reiser4_init(void) {
|
|
||||||
+ extern aal_hash_table_t *plugins;
|
|
||||||
+
|
|
||||||
+ plugins = NULL;
|
|
||||||
+
|
|
||||||
+ /* Initializing memory manager */
|
|
||||||
+ aal_mem_init((void *)FSYS_BUF, FSYS_BUFLEN);
|
|
||||||
+
|
|
||||||
+ /* Initializing device abstraction on current device GRUB uses. */
|
|
||||||
+ if (!(dev = aal_device_open(&grub_dev_ops, NULL,
|
|
||||||
+ SECTOR_SIZE, 0)))
|
|
||||||
+ {
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Initializing libreiser4 (plugins, etc) */
|
|
||||||
+ return !libreiser4_init();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#define MEMORY_WATERMARK 8192
|
|
||||||
+
|
|
||||||
+/* Memory pressure detect function. */
|
|
||||||
+static int mpressure_detect(reiser4_tree_t *tree) {
|
|
||||||
+ return (aal_mem_free() <= MEMORY_WATERMARK);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Reiser4 mount() routine */
|
|
||||||
+int reiser4_mount(void) {
|
|
||||||
+
|
|
||||||
+ /* Initialize all reiser4 related stuff first */
|
|
||||||
+ if (!reiser4_init())
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ /* Open filesystem on @dev. */
|
|
||||||
+ if (!(fs = reiser4_fs_open(dev)))
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ fs->tree->mpc_func = mpressure_detect;
|
|
||||||
+
|
|
||||||
+ object = NULL;
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Reiser4 read() handler */
|
|
||||||
+int reiser4_read(char *buf, int len) {
|
|
||||||
+ int64_t read;
|
|
||||||
+
|
|
||||||
+ if (object == NULL)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ /* Seet at current position denoted by @filepos */
|
|
||||||
+ if (objplug(object)->o.object_ops->seek) {
|
|
||||||
+ plug_call(objplug(object)->o.object_ops,
|
|
||||||
+ seek, object->ent, filepos);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Reading current file data starting from @filepos */
|
|
||||||
+ disk_read_func = disk_read_hook;
|
|
||||||
+ read = objplug(object)->o.object_ops->read ?
|
|
||||||
+ plug_call(objplug(object)->o.object_ops, read,
|
|
||||||
+ object->ent, buf, len) : -EINVAL;
|
|
||||||
+ disk_read_func = NULL;
|
|
||||||
+
|
|
||||||
+ if (read < 0) {
|
|
||||||
+ errnum = ERR_FSYS_CORRUPT;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ filepos += read;
|
|
||||||
+ return read;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Reiser4 file open() routine */
|
|
||||||
+int reiser4_dir(char *dirname) {
|
|
||||||
+ char *ch;
|
|
||||||
+
|
|
||||||
+ if (fs == NULL)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (object != NULL) {
|
|
||||||
+ plug_call(objplug(object)->o.object_ops,
|
|
||||||
+ close, object->ent);
|
|
||||||
+ aal_free(object);
|
|
||||||
+ object = NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Cutting out string after first space character */
|
|
||||||
+ if ((ch = aal_strchr(dirname, ' ')))
|
|
||||||
+ *ch = '\0';
|
|
||||||
+
|
|
||||||
+ /* This function is also called for getting directory list for
|
|
||||||
+ maintaining the bash-like completion. */
|
|
||||||
+#ifndef STAGE1_5
|
|
||||||
+ if (print_possibilities) {
|
|
||||||
+ char entry[256];
|
|
||||||
+ entry_hint_t entry_hint;
|
|
||||||
+
|
|
||||||
+ /* Getting last part of name (jsut after last '/') */
|
|
||||||
+ if (*(dirname + aal_strlen(dirname) - 1) != '/') {
|
|
||||||
+
|
|
||||||
+ if (!(ch = aal_strrchr(dirname, '/'))) {
|
|
||||||
+ errnum = ERR_BAD_FILETYPE;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ aal_strncpy(entry, ch + 1, sizeof(entry));
|
|
||||||
+ *(ch + 1) = '\0';
|
|
||||||
+ } else {
|
|
||||||
+ aal_memset(entry, 0, sizeof(entry));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Open obejct by @dirname */
|
|
||||||
+ if (!(object = reiser4_semantic_open(fs->tree, dirname,
|
|
||||||
+ NULL, 1)))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FILE_NOT_FOUND;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Checking if it is a directory object */
|
|
||||||
+ if (object->ent->opset.plug[OPSET_OBJ]->id.group != DIR_OBJECT)
|
|
||||||
+ {
|
|
||||||
+ /* If not, cutting out last '/' character */
|
|
||||||
+ if ((ch = aal_strrchr(dirname, '/')))
|
|
||||||
+ *ch = '\0';
|
|
||||||
+
|
|
||||||
+ /* Close current object */
|
|
||||||
+ plug_call(objplug(object)->o.object_ops,
|
|
||||||
+ close, object->ent);
|
|
||||||
+ aal_free(object);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Reading the opened directory to build the completion list. */
|
|
||||||
+ if (objplug(object)->o.object_ops->readdir) {
|
|
||||||
+ while (plug_call(objplug(object)->o.object_ops, readdir,
|
|
||||||
+ object->ent, &entry_hint) > 0)
|
|
||||||
+ {
|
|
||||||
+ if (substring(entry, entry_hint.name) <= 0) {
|
|
||||||
+ if (print_possibilities > 0)
|
|
||||||
+ print_possibilities =
|
|
||||||
+ -print_possibilities;
|
|
||||||
+
|
|
||||||
+ print_a_completion(entry_hint.name);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+#endif
|
|
||||||
+ /* This is the case when resier4_dir() is called for open the
|
|
||||||
+ file @dirname, not for building completion list. */
|
|
||||||
+ if (!(object = reiser4_semantic_open(fs->tree, dirname,
|
|
||||||
+ NULL, 1)))
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_FILE_NOT_FOUND;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (object->ent->opset.plug[OPSET_OBJ]->id.group != REG_OBJECT)
|
|
||||||
+ {
|
|
||||||
+ errnum = ERR_BAD_FILETYPE;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Initializing GRUB global variables @filepos and @filemax. */
|
|
||||||
+ filepos = 0;
|
|
||||||
+ filemax = reiser4_object_size(object);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+#ifndef STAGE1_5
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ errnum = ERR_FILE_NOT_FOUND;
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Returns how many sectors may be used for embeding reiser4_stage1_5 in teh
|
|
||||||
+ case of installing GRUB to partition instead of MBR. */
|
|
||||||
+int reiser4_embed (int *start_sector, int needed_sectors) {
|
|
||||||
+ *start_sector = 1;
|
|
||||||
+ return needed_sectors <= ((REISER4_MASTER_OFFSET >> SECTOR_BITS) - 1);
|
|
||||||
+}
|
|
||||||
+#endif /* FSYS_REISER4 */
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/Makefile.am grub-0.97-1/stage2/Makefile.am
|
|
||||||
--- grub-0.97/stage2/Makefile.am 2005-02-02 23:37:35.000000000 +0300
|
|
||||||
+++ grub-0.97-1/stage2/Makefile.am 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -13,17 +13,25 @@ EXTRA_DIST = setjmp.S apm.S $(noinst_SCR
|
|
||||||
# For <stage1.h>.
|
|
||||||
INCLUDES = -I$(top_srcdir)/stage1
|
|
||||||
|
|
||||||
+if ENABLE_REISER4_SUPPORT
|
|
||||||
+REISER4_STAGE1_5 = reiser4_stage1_5
|
|
||||||
+REISER4_STAGE1_5_EXEC = reiser4_stage1_5.exec
|
|
||||||
+else
|
|
||||||
+REISER4_STAGE1_5 =
|
|
||||||
+REISER4_STAGE1_5_EXEC =
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
# The library for /sbin/grub.
|
|
||||||
noinst_LIBRARIES = libgrub.a
|
|
||||||
libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
|
|
||||||
disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
|
|
||||||
- fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
|
|
||||||
+ fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_reiser4.c fsys_ufs2.c \
|
|
||||||
fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
|
|
||||||
terminfo.c tparm.c
|
|
||||||
libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
|
|
||||||
-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
|
|
||||||
-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
|
|
||||||
- -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
|
|
||||||
+ $(REISER4_CFLAGS) -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
|
|
||||||
-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
|
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
|
||||||
@@ -34,24 +42,26 @@ EXTRA_PROGRAMS = nbloader.exec pxeloader
|
|
||||||
if DISKLESS_SUPPORT
|
|
||||||
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
|
|
||||||
- reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
|
|
||||||
- nbgrub pxegrub
|
|
||||||
+ reiserfs_stage1_5 $(REISER4_STAGE1_5) ufs2_stage1_5 \
|
|
||||||
+ vstafs_stage1_5 xfs_stage1_5 nbgrub pxegrub
|
|
||||||
noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
|
|
||||||
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
|
|
||||||
e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
|
|
||||||
iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
|
|
||||||
- reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
|
|
||||||
- xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
|
|
||||||
+ reiserfs_stage1_5.exec $(REISER4_STAGE1_5_EXEC) ufs2_stage1_5.exec \
|
|
||||||
+ vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec pxeloader.exec \
|
|
||||||
+ diskless.exec
|
|
||||||
else
|
|
||||||
pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
|
|
||||||
ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
|
|
||||||
- reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
|
|
||||||
+ reiserfs_stage1_5 $(REISER4_STAGE1_5) ufs2_stage1_5 \
|
|
||||||
+ vstafs_stage1_5 xfs_stage1_5
|
|
||||||
noinst_DATA = pre_stage2 start start_eltorito
|
|
||||||
noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
|
|
||||||
e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
|
|
||||||
iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
|
|
||||||
- reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
|
|
||||||
- xfs_stage1_5.exec
|
|
||||||
+ reiserfs_stage1_5.exec $(REISER4_STAGE1_5_EXEC) ufs2_stage1_5.exec \
|
|
||||||
+ vstafs_stage1_5.exec xfs_stage1_5.exec
|
|
||||||
endif
|
|
||||||
MOSTLYCLEANFILES = $(noinst_PROGRAMS)
|
|
||||||
|
|
||||||
@@ -79,7 +89,7 @@ else
|
|
||||||
HERCULES_FLAGS =
|
|
||||||
endif
|
|
||||||
|
|
||||||
-STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
|
|
||||||
+STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin \
|
|
||||||
$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
|
|
||||||
|
|
||||||
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
|
|
||||||
@@ -89,14 +99,17 @@ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DN
|
|
||||||
pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
|
|
||||||
cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
|
|
||||||
fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
|
|
||||||
- fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
|
|
||||||
- hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c
|
|
||||||
+ fsys_reiserfs.c fsys_reiser4.c fsys_ufs2.c fsys_vstafs.c \
|
|
||||||
+ fsys_xfs.c gunzip.c hercules.c md5.c serial.c smp-imps.c \
|
|
||||||
+ stage2.c terminfo.c tparm.c
|
|
||||||
pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
|
|
||||||
pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
|
|
||||||
pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
|
|
||||||
|
|
||||||
if NETBOOT_SUPPORT
|
|
||||||
-pre_stage2_exec_LDADD = ../netboot/libdrivers.a
|
|
||||||
+pre_stage2_exec_LDADD = ../netboot/libdrivers.a $(REISER4_LIBS)
|
|
||||||
+else
|
|
||||||
+pre_stage2_exec_LDADD = $(REISER4_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if DISKLESS_SUPPORT
|
|
||||||
@@ -190,6 +203,16 @@ reiserfs_stage1_5_exec_CCASFLAGS = $(STA
|
|
||||||
-DNO_BLOCK_FILES=1
|
|
||||||
reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
|
|
||||||
|
|
||||||
+# For reiser4_stage1_5 target.
|
|
||||||
+reiser4_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
|
|
||||||
+ disk_io.c stage1_5.c fsys_reiser4.c bios.c
|
|
||||||
+reiser4_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) $(REISER4_CFLAGS) \
|
|
||||||
+ -DNO_BLOCK_FILES=1
|
|
||||||
+reiser4_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) $(REISER4_CFLAGS) \
|
|
||||||
+ -DNO_BLOCK_FILES=1
|
|
||||||
+reiser4_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
|
|
||||||
+reiser4_stage1_5_exec_LDADD = $(REISER4_LIBS)
|
|
||||||
+
|
|
||||||
# For vstafs_stage1_5 target.
|
|
||||||
vstafs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
|
|
||||||
disk_io.c stage1_5.c fsys_vstafs.c bios.c
|
|
||||||
diff -upNr --exclude=Makefile.in --exclude='*.info' --exclude='*.m4' --exclude='*cache' --exclude=configure --exclude=.deps grub-0.97/stage2/shared.h grub-0.97-1/stage2/shared.h
|
|
||||||
--- grub-0.97/stage2/shared.h 2004-06-19 20:40:09.000000000 +0400
|
|
||||||
+++ grub-0.97-1/stage2/shared.h 2005-08-05 22:48:24.000000000 +0400
|
|
||||||
@@ -207,11 +207,12 @@ extern char *grub_scratch_mem;
|
|
||||||
#define STAGE2_ID_FAT_STAGE1_5 3
|
|
||||||
#define STAGE2_ID_MINIX_STAGE1_5 4
|
|
||||||
#define STAGE2_ID_REISERFS_STAGE1_5 5
|
|
||||||
-#define STAGE2_ID_VSTAFS_STAGE1_5 6
|
|
||||||
-#define STAGE2_ID_JFS_STAGE1_5 7
|
|
||||||
-#define STAGE2_ID_XFS_STAGE1_5 8
|
|
||||||
-#define STAGE2_ID_ISO9660_STAGE1_5 9
|
|
||||||
-#define STAGE2_ID_UFS2_STAGE1_5 10
|
|
||||||
+#define STAGE2_ID_REISER4_STAGE1_5 6
|
|
||||||
+#define STAGE2_ID_VSTAFS_STAGE1_5 7
|
|
||||||
+#define STAGE2_ID_JFS_STAGE1_5 8
|
|
||||||
+#define STAGE2_ID_XFS_STAGE1_5 9
|
|
||||||
+#define STAGE2_ID_ISO9660_STAGE1_5 10
|
|
||||||
+#define STAGE2_ID_UFS2_STAGE1_5 11
|
|
||||||
|
|
||||||
#ifndef STAGE1_5
|
|
||||||
# define STAGE2_ID STAGE2_ID_STAGE2
|
|
||||||
@@ -226,6 +227,8 @@ extern char *grub_scratch_mem;
|
|
||||||
# define STAGE2_ID STAGE2_ID_MINIX_STAGE1_5
|
|
||||||
# elif defined(FSYS_REISERFS)
|
|
||||||
# define STAGE2_ID STAGE2_ID_REISERFS_STAGE1_5
|
|
||||||
+# elif defined(FSYS_REISER4)
|
|
||||||
+# define STAGE2_ID STAGE2_ID_REISER4_STAGE1_5
|
|
||||||
# elif defined(FSYS_VSTAFS)
|
|
||||||
# define STAGE2_ID STAGE2_ID_VSTAFS_STAGE1_5
|
|
||||||
# elif defined(FSYS_JFS)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
--- grub-0.95/lib/device.c.orig 2004-05-23 18:34:29.000000000 +0200
|
|
||||||
+++ grub-0.95/lib/device.c 2004-09-21 18:15:23.785137837 +0200
|
|
||||||
@@ -828,9 +828,11 @@ int
|
|
||||||
is_disk_device (char **map, int drive)
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
+ int retval;
|
|
||||||
|
|
||||||
assert (map[drive] != 0);
|
|
||||||
- assert (stat (map[drive], &st) == 0);
|
|
||||||
+ retval = stat (map[drive], &st);
|
|
||||||
+ assert (retval == 0);
|
|
||||||
/* For now, disk devices under Linux are all block devices. */
|
|
||||||
return S_ISBLK (st.st_mode);
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- grub-0.97/netboot/i82586.c.orig 2003-07-09 13:45:37.000000000 +0200
|
|
||||||
+++ grub-0.97/netboot/i82586.c 2006-04-20 18:50:20.000000000 +0200
|
|
||||||
@@ -735,7 +735,7 @@ static unsigned char exos_i186_init[] =
|
|
||||||
static int exos205_probe2(void)
|
|
||||||
{
|
|
||||||
unsigned short i;
|
|
||||||
- unsigned short shmem[10];
|
|
||||||
+ unsigned short shmem[10] = { 0,0,0,0,0,0,0,0,0,0 };
|
|
||||||
|
|
||||||
/* Fix the ISCP address and base. */
|
|
||||||
init_words[3] = scb_base;
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
diff -ur grub-0.93~/docs/grub.texi grub-0.93/docs/grub.texi
|
|
||||||
--- grub-0.93~/docs/grub.texi 2003-02-06 12:30:12.000000000 +0100
|
|
||||||
+++ grub-0.93/docs/grub.texi 2003-02-06 14:15:30.000000000 +0100
|
|
||||||
@@ -2632,7 +2632,7 @@
|
|
||||||
@node install
|
|
||||||
@subsection install
|
|
||||||
|
|
||||||
-@deffn Command install [@option{--force-lba}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file]
|
|
||||||
+@deffn Command install [@option{--force-lba[=off]}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file]
|
|
||||||
This command is fairly complex, and you should not use this command
|
|
||||||
unless you are familiar with GRUB. Use @command{setup} (@pxref{setup})
|
|
||||||
instead.
|
|
||||||
@@ -2679,6 +2679,13 @@
|
|
||||||
bitmap even if they do have the support. So GRUB provides a solution to
|
|
||||||
ignore the wrong bitmap, that is, the option @option{--force-lba}. Don't
|
|
||||||
use this option if you know that your BIOS doesn't have LBA support.
|
|
||||||
+On the other hand there is at least one known BIOS that does the opposite,
|
|
||||||
+it claims to support LBA and then fails to provide it. Iff you have an
|
|
||||||
+Adaptec 2940 with BIOS revision 1.21 ( newer ones just work and older ones
|
|
||||||
+don't make the false claim ), or otherwise experience grub hanging
|
|
||||||
+after stage1, you can try to use the option @option{--force-lba=off},
|
|
||||||
+as long as all disk blocks involved in booting reside
|
|
||||||
+within the first 1024 cylinders.
|
|
||||||
|
|
||||||
@strong{Caution3:} You must specify the option @option{--stage2} in the
|
|
||||||
grub shell, if you cannot unmount the filesystem where your stage2 file
|
|
||||||
diff -ur grub-0.93~/stage1/stage1.S grub-0.93/stage1/stage1.S
|
|
||||||
--- grub-0.93~/stage1/stage1.S 2002-09-08 03:58:08.000000000 +0200
|
|
||||||
+++ grub-0.93/stage1/stage1.S 2003-02-06 13:19:50.000000000 +0100
|
|
||||||
@@ -163,7 +163,11 @@
|
|
||||||
/* check if AH=0x42 is supported if FORCE_LBA is zero */
|
|
||||||
MOV_MEM_TO_AL(ABS(force_lba)) /* movb ABS(force_lba), %al */
|
|
||||||
testb %al, %al
|
|
||||||
+ /* check if LBA is forced OFF 0x80 <= %al <= 0xff */
|
|
||||||
+ js chs_mode
|
|
||||||
+ /* or forced ON 0x01 <= %al <= 0x7f */
|
|
||||||
jnz lba_mode
|
|
||||||
+ /* otherwise trust BIOS int's result */
|
|
||||||
andw $1, %cx
|
|
||||||
jz chs_mode
|
|
||||||
|
|
||||||
diff -ur grub-0.93~/stage2/asm.S grub-0.93/stage2/asm.S
|
|
||||||
--- grub-0.93~/stage2/asm.S 2003-02-06 12:30:12.000000000 +0100
|
|
||||||
+++ grub-0.93/stage2/asm.S 2003-02-06 13:35:32.000000000 +0100
|
|
||||||
@@ -1083,7 +1083,11 @@
|
|
||||||
/* check if AH=0x42 is supported if FORCE_LBA is zero */
|
|
||||||
movb EXT_C(force_lba), %al
|
|
||||||
testb %al, %al
|
|
||||||
+ /* check if LBA is forced OFF 0x80 <= %al <= 0xff */
|
|
||||||
+ js 1f
|
|
||||||
+ /* or forced ON 0x01 <= %al <= 0x7f */
|
|
||||||
jnz 2f
|
|
||||||
+ /* otherwise trust BIOS int's result */
|
|
||||||
andw $1, %cx
|
|
||||||
jnz 2f
|
|
||||||
|
|
||||||
diff -ur grub-0.93~/stage2/builtins.c grub-0.93/stage2/builtins.c
|
|
||||||
--- grub-0.93~/stage2/builtins.c 2003-02-06 12:30:12.000000000 +0100
|
|
||||||
+++ grub-0.93/stage2/builtins.c 2003-02-06 13:56:01.000000000 +0100
|
|
||||||
@@ -1832,7 +1832,12 @@
|
|
||||||
/* First, check the GNU-style long option. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
- if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
|
|
||||||
+ if (grub_memcmp ("--force-lba=off", arg, sizeof ("--force-lba=off") - 1) == 0)
|
|
||||||
+ {
|
|
||||||
+ is_force_lba = 0xff;
|
|
||||||
+ arg = skip_to (0, arg);
|
|
||||||
+ }
|
|
||||||
+ else if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
|
|
||||||
{
|
|
||||||
is_force_lba = 1;
|
|
||||||
arg = skip_to (0, arg);
|
|
||||||
@@ -2253,7 +2258,7 @@
|
|
||||||
"install",
|
|
||||||
install_func,
|
|
||||||
BUILTIN_CMDLINE,
|
|
||||||
- "install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]",
|
|
||||||
+ "install [--stage2=STAGE2_FILE] [--force-lba[=off]] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]",
|
|
||||||
"Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2"
|
|
||||||
" as a Stage 2. If the option `d' is present, the Stage 1 will always"
|
|
||||||
" look for the disk where STAGE2 was installed, rather than using"
|
|
||||||
@@ -2266,8 +2271,9 @@
|
|
||||||
" 1.5 and REAL_CONFIG_FILE is present, then the Stage 2 CONFIG_FILE is"
|
|
||||||
" patched with the configuration filename REAL_CONFIG_FILE."
|
|
||||||
" If the option `--force-lba' is specified, disable some sanity checks"
|
|
||||||
- " for LBA mode. If the option `--stage2' is specified, rewrite the Stage"
|
|
||||||
- " 2 via your OS's filesystem instead of the raw device."
|
|
||||||
+ " for LBA mode, `--force-lba=off' will disable it completely. If the"
|
|
||||||
+ " option `--stage2' is specified, rewrite the Stage 2 via your OS's"
|
|
||||||
+ " filesystem instead of the raw device."
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -3898,7 +3904,12 @@
|
|
||||||
/* Check if the user specifies --force-lba. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
- if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
|
|
||||||
+ if (grub_memcmp ("--force-lba=off", arg, sizeof ("--force-lba=off") - 1) == 0)
|
|
||||||
+ {
|
|
||||||
+ is_force_lba = 0xff;
|
|
||||||
+ arg = skip_to (0, arg);
|
|
||||||
+ }
|
|
||||||
+ else if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
|
|
||||||
{
|
|
||||||
is_force_lba = 1;
|
|
||||||
arg = skip_to (0, arg);
|
|
||||||
@@ -4026,7 +4037,9 @@
|
|
||||||
#if 1
|
|
||||||
/* Don't embed a drive number unnecessarily. */
|
|
||||||
grub_sprintf (cmd_arg, "%s%s%s%s %s%s %s p %s %s",
|
|
||||||
- is_force_lba? "--force-lba " : "",
|
|
||||||
+ is_force_lba ?
|
|
||||||
+ (is_force_lba == 0xff ? "--force-lba=off " : "--force-lba ")
|
|
||||||
+ : "",
|
|
||||||
stage2_arg? stage2_arg : "",
|
|
||||||
stage2_arg? " " : "",
|
|
||||||
stage1,
|
|
||||||
@@ -4079,17 +4092,18 @@
|
|
||||||
"setup",
|
|
||||||
setup_func,
|
|
||||||
BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
|
|
||||||
- "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]",
|
|
||||||
+ "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba[=off]] INSTALL_DEVICE [IMAGE_DEVICE]",
|
|
||||||
"Set up the installation of GRUB automatically. This command uses"
|
|
||||||
" the more flexible command \"install\" in the backend and installs"
|
|
||||||
" GRUB into the device INSTALL_DEVICE. If IMAGE_DEVICE is specified,"
|
|
||||||
" then find the GRUB images in the device IMAGE_DEVICE, otherwise"
|
|
||||||
" use the current \"root device\", which can be set by the command"
|
|
||||||
" \"root\". If you know that your BIOS should support LBA but GRUB"
|
|
||||||
- " doesn't work in LBA mode, specify the option `--force-lba'."
|
|
||||||
- " If you install GRUB under the grub shell and you cannot unmount the"
|
|
||||||
- " partition where GRUB images reside, specify the option `--stage2'"
|
|
||||||
- " to tell GRUB the file name under your OS."
|
|
||||||
+ " doesn't work in LBA mode, specify the option `--force-lba'. If the"
|
|
||||||
+ " BIOS claims to support LBA mode but really doesn't, use"
|
|
||||||
+ " `--force-lba=off'. If you install GRUB under the grub shell and"
|
|
||||||
+ " you cannot unmount the partition where GRUB images reside, specify"
|
|
||||||
+ " the option `--stage2' to tell GRUB the file name under your OS."
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
diff -Burbp grub-0.93.orig/grub/main.c grub-0.93/grub/main.c
|
|
||||||
--- grub-0.93.orig/grub/main.c 2003-06-10 18:29:37.000000000 +0200
|
|
||||||
+++ grub-0.93/grub/main.c 2003-06-10 18:30:36.000000000 +0200
|
|
||||||
@@ -44,7 +44,7 @@ int use_curses = 0;
|
|
||||||
int verbose = 0;
|
|
||||||
int read_only = 0;
|
|
||||||
int floppy_disks = 1;
|
|
||||||
-char *device_map_file = 0;
|
|
||||||
+char *device_map_file = "/boot/grub/device.map";
|
|
||||||
static int default_boot_drive;
|
|
||||||
static int default_install_partition;
|
|
||||||
static char *default_config_file;
|
|
||||||
diff -Burbp grub-0.93.orig/lib/device.c grub-0.93/lib/device.c
|
|
||||||
--- grub-0.93.orig/lib/device.c 2003-06-10 18:29:37.000000000 +0200
|
|
||||||
+++ grub-0.93/lib/device.c 2003-06-10 18:30:36.000000000 +0200
|
|
||||||
@@ -382,6 +382,7 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
probing devices. */
|
|
||||||
char buf[1024]; /* XXX */
|
|
||||||
int line_number = 0;
|
|
||||||
+ int retval = 0; /* default to failure */
|
|
||||||
|
|
||||||
while (fgets (buf, sizeof (buf), fp))
|
|
||||||
{
|
|
||||||
@@ -408,14 +409,14 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
if (*ptr != '(')
|
|
||||||
{
|
|
||||||
show_error (line_number, "No open parenthesis found");
|
|
||||||
- return 0;
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr++;
|
|
||||||
if ((*ptr != 'f' && *ptr != 'h') || *(ptr + 1) != 'd')
|
|
||||||
{
|
|
||||||
show_error (line_number, "Bad drive name");
|
|
||||||
- return 0;
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*ptr == 'f')
|
|
||||||
@@ -426,7 +427,7 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
if (drive < 0 || drive > 8)
|
|
||||||
{
|
|
||||||
show_error (line_number, "Bad device number");
|
|
||||||
- return 0;
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! is_floppy)
|
|
||||||
@@ -435,7 +436,7 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
if (*ptr != ')')
|
|
||||||
{
|
|
||||||
show_error (line_number, "No close parenthesis found");
|
|
||||||
- return 0;
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr++;
|
|
||||||
@@ -446,7 +447,7 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
if (! *ptr)
|
|
||||||
{
|
|
||||||
show_error (line_number, "No filename found");
|
|
||||||
- return 0;
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Terminate the filename. */
|
|
||||||
@@ -464,9 +465,11 @@ read_device_map (FILE *fp, char **map, c
|
|
||||||
|
|
||||||
map[drive] = strdup (ptr);
|
|
||||||
assert (map[drive]);
|
|
||||||
+
|
|
||||||
+ retval = 1; /* at least 1 drive configured successfully */
|
|
||||||
}
|
|
||||||
|
|
||||||
- return 1;
|
|
||||||
+ return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the device map MAP. *MAP will be allocated from the heap
|
|
||||||
@@ -671,7 +674,7 @@ write_to_partition (char **map, int driv
|
|
||||||
int sector, int size, const char *buf)
|
|
||||||
{
|
|
||||||
char dev[PATH_MAX]; /* XXX */
|
|
||||||
- int fd;
|
|
||||||
+ int fd, len, pnum;
|
|
||||||
|
|
||||||
if ((partition & 0x00FF00) != 0x00FF00)
|
|
||||||
{
|
|
||||||
@@ -689,7 +692,16 @@ write_to_partition (char **map, int driv
|
|
||||||
if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
|
|
||||||
strcpy (dev + strlen(dev) - 5, "/part");
|
|
||||||
}
|
|
||||||
- sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
|
|
||||||
+
|
|
||||||
+ len = strlen(dev);
|
|
||||||
+ pnum = ((partition >> 16) & 0xFF);
|
|
||||||
+ if (isdigit(dev[len-1]))
|
|
||||||
+ {
|
|
||||||
+ /* It is obviously some RAID disk: "/dev/<dsk>/c0d0" . "p1" */
|
|
||||||
+ sprintf (dev + len, "p%d", pnum + 1);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ sprintf (dev + len, "%d", pnum + 1);
|
|
||||||
|
|
||||||
/* Open the partition. */
|
|
||||||
fd = open (dev, O_RDWR);
|
|
||||||
--- grub-0.94/util/grub-md5-crypt.in.orig 2003-07-09 04:45:51.000000000 -0700
|
|
||||||
+++ grub-0.94/util/grub-md5-crypt.in 2004-05-11 09:26:31.943224317 -0700
|
|
||||||
@@ -88,7 +88,7 @@
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the grub shell.
|
|
||||||
-$grub_shell --batch --device-map=/dev/null <<EOF \
|
|
||||||
+$grub_shell --batch <<EOF \
|
|
||||||
| grep "^Encrypted: " | sed 's/^Encrypted: //'
|
|
||||||
md5crypt
|
|
||||||
$password
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
--- grub-0.96/stage2/boot.c
|
|
||||||
+++ grub-0.96/stage2/boot.c
|
|
||||||
@@ -824,8 +824,11 @@
|
|
||||||
moveto = (mbi.mem_upper + 0x400) << 10;
|
|
||||||
|
|
||||||
moveto = (moveto - len) & 0xfffff000;
|
|
||||||
- max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
|
|
||||||
- ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
|
|
||||||
+ max_addr = LINUX_INITRD_MAX_ADDRESS;
|
|
||||||
+ if (lh->header == LINUX_MAGIC_SIGNATURE &&
|
|
||||||
+ lh->version >= 0x0203 &&
|
|
||||||
+ lh->initrd_addr_max < max_addr)
|
|
||||||
+ max_addr = lh->initrd_addr_max;
|
|
||||||
if (moveto + len >= max_addr)
|
|
||||||
moveto = (max_addr - len) & 0xfffff000;
|
|
||||||
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
diff -ur grub-0.93/Makefile.am grub-0.93.new/Makefile.am
|
|
||||||
--- grub-0.93/Makefile.am 2002-07-01 16:15:36.000000000 +0200
|
|
||||||
+++ grub-0.93.new/Makefile.am 2003-02-04 13:03:36.000000000 +0100
|
|
||||||
@@ -2,3 +2,4 @@
|
|
||||||
AUTOMAKE_OPTIONS = 1.5
|
|
||||||
SUBDIRS = netboot stage2 stage1 lib grub util docs
|
|
||||||
EXTRA_DIST = BUGS MAINTENANCE
|
|
||||||
+pkgdatadir=$(datadir)
|
|
||||||
diff -ur grub-0.93/stage1/Makefile.am grub-0.93.new/stage1/Makefile.am
|
|
||||||
--- grub-0.93/stage1/Makefile.am 2002-09-08 03:58:08.000000000 +0200
|
|
||||||
+++ grub-0.93.new/stage1/Makefile.am 2003-02-04 13:03:36.000000000 +0100
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
+pkglibdir = /usr/lib/grub
|
|
||||||
nodist_pkglib_DATA = stage1
|
|
||||||
|
|
||||||
CLEANFILES = $(nodist_pkglib_DATA)
|
|
||||||
diff -ur grub-0.93/stage2/Makefile.am grub-0.93.new/stage2/Makefile.am
|
|
||||||
--- grub-0.93/stage2/Makefile.am 2002-11-29 19:00:53.000000000 +0100
|
|
||||||
+++ grub-0.93.new/stage2/Makefile.am 2003-02-04 13:03:36.000000000 +0100
|
|
||||||
@@ -26,7 +26,7 @@
|
|
||||||
-DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1 -fwritable-strings
|
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
|
||||||
-pkglibdir = $(libdir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
|
|
||||||
+pkglibdir = /usr/lib/grub
|
|
||||||
|
|
||||||
EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
|
|
||||||
|
|
||||||
diff -ur grub-0.93/util/grub-install.in grub-0.93.new/util/grub-install.in
|
|
||||||
--- grub-0.93/util/grub-install.in 2002-05-20 13:21:50.000000000 +0200
|
|
||||||
+++ grub-0.93.new/util/grub-install.in 2003-02-04 13:03:36.000000000 +0100
|
|
||||||
@@ -27,7 +27,7 @@
|
|
||||||
host_cpu=@host_cpu@
|
|
||||||
host_os=@host_os@
|
|
||||||
host_vendor=@host_vendor@
|
|
||||||
-pkglibdir=${libdir}/${PACKAGE}/${host_cpu}-${host_vendor}
|
|
||||||
+pkglibdir=${libdir}/${PACKAGE}/
|
|
||||||
|
|
||||||
grub_shell=${sbindir}/grub
|
|
||||||
grub_set_default=${sbindir}/grub-set-default
|
|
||||||
@@ -378,14 +378,19 @@
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
-# Copy the GRUB images to the GRUB directory.
|
|
||||||
-for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
|
|
||||||
- rm -f $file || exit 1
|
|
||||||
-done
|
|
||||||
-for file in \
|
|
||||||
- ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do
|
|
||||||
- cp -f $file ${grubdir} || exit 1
|
|
||||||
-done
|
|
||||||
+# FHS says that /usr/share is used for architecture independent data,
|
|
||||||
+# so all stage-files are directly installed to /usr/lib/grub.
|
|
||||||
+# Therefor this part is no longer needed.
|
|
||||||
+# <--cut_here-->
|
|
||||||
+## Copy the GRUB images to the GRUB directory.
|
|
||||||
+#for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
|
|
||||||
+# rm -f $file || exit 1
|
|
||||||
+#done
|
|
||||||
+#for file in \
|
|
||||||
+# ${pkglibdir}/stage1 ${pkglibdir}/stage2 ${pkglibdir}/*stage1_5; do
|
|
||||||
+# cp -f $file ${grubdir} || exit 1
|
|
||||||
+#done
|
|
||||||
+# <--uncut-->
|
|
||||||
|
|
||||||
# Make sure that GRUB reads the same images as the host OS.
|
|
||||||
test -n "$mkimg" && img_file=`$mkimg`
|
|
||||||
Only in grub-0.93.new/util: grub-install.in.orig
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
--- grub-0.96/grub/asmstub.c
|
|
||||||
+++ grub-0.96/grub/asmstub.c
|
|
||||||
@@ -43,6 +43,8 @@
|
|
||||||
#include <termios.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
+#include <sys/mman.h>
|
|
||||||
+
|
|
||||||
#ifdef __linux__
|
|
||||||
# include <sys/ioctl.h> /* ioctl */
|
|
||||||
# if !defined(__GLIBC__) || \
|
|
||||||
@@ -140,14 +142,30 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
assert (grub_scratch_mem == 0);
|
|
||||||
- scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);
|
|
||||||
+#ifdef MAP_32BIT
|
|
||||||
+#define MY_MAP_SET MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS | MAP_32BIT
|
|
||||||
+#else
|
|
||||||
+#define MY_MAP_SET MAP_PRIVATE | MAP_GROWSDOWN | MAP_ANONYMOUS
|
|
||||||
+#endif
|
|
||||||
+ scratch = mmap(NULL,
|
|
||||||
+ 0x100000 + EXTENDED_MEMSIZE + 15,
|
|
||||||
+ PROT_EXEC | PROT_READ | PROT_WRITE,
|
|
||||||
+ MY_MAP_SET,
|
|
||||||
+ -1,
|
|
||||||
+ 0);
|
|
||||||
+
|
|
||||||
assert (scratch);
|
|
||||||
grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4);
|
|
||||||
|
|
||||||
/* FIXME: simulate the memory holes using mprot, if available. */
|
|
||||||
|
|
||||||
assert (disks == 0);
|
|
||||||
- disks = malloc (NUM_DISKS * sizeof (*disks));
|
|
||||||
+ disks = mmap(NULL,
|
|
||||||
+ NUM_DISKS * sizeof (*disks),
|
|
||||||
+ PROT_EXEC | PROT_READ | PROT_WRITE,
|
|
||||||
+ MY_MAP_SET,
|
|
||||||
+ -1,
|
|
||||||
+ 0);
|
|
||||||
assert (disks);
|
|
||||||
/* Initialize DISKS. */
|
|
||||||
for (i = 0; i < NUM_DISKS; i++)
|
|
||||||
@@ -213,9 +231,9 @@
|
|
||||||
/* Release memory. */
|
|
||||||
restore_device_map (device_map);
|
|
||||||
device_map = 0;
|
|
||||||
- free (disks);
|
|
||||||
+ munmap(disks, NUM_DISKS * sizeof (*disks));
|
|
||||||
disks = 0;
|
|
||||||
- free (scratch);
|
|
||||||
+ munmap(scratch, 0x100000 + EXTENDED_MEMSIZE + 15);
|
|
||||||
grub_scratch_mem = 0;
|
|
||||||
|
|
||||||
if (serial_device)
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
--- grub-0.96/stage2/builtins.c.orig 2004-06-20 15:33:04.000000000 +0200
|
|
||||||
+++ grub-0.96/stage2/builtins.c 2005-09-02 14:38:53.000000000 +0200
|
|
||||||
@@ -762,11 +762,11 @@
|
|
||||||
default_func (char *arg, int flags)
|
|
||||||
{
|
|
||||||
#ifndef SUPPORT_DISKLESS
|
|
||||||
- if (grub_strcmp (arg, "saved") == 0)
|
|
||||||
+ if (grub_strcmp (arg, "saved") == 0 || (saved_entryno & 0x4000))
|
|
||||||
{
|
|
||||||
- default_entry = saved_entryno;
|
|
||||||
- return 0;
|
|
||||||
+ default_entry = saved_entryno & 0x3fff;
|
|
||||||
}
|
|
||||||
+ else
|
|
||||||
#endif /* SUPPORT_DISKLESS */
|
|
||||||
|
|
||||||
if (! safe_parse_maxint (&arg, &default_entry))
|
|
||||||
@@ -787,6 +787,22 @@
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
+#ifndef SUPPORT_DISKLESS
|
|
||||||
+static int savedefault_func (char *arg, int flags);
|
|
||||||
+void __savedefault_once_reset()
|
|
||||||
+{
|
|
||||||
+ if (saved_entryno & 0x4000)
|
|
||||||
+ {
|
|
||||||
+ int saved_current_entryno = current_entryno;
|
|
||||||
+ grub_timeout = 0;
|
|
||||||
+ current_entryno = default_entry;
|
|
||||||
+ savedefault_func("\0", BUILTIN_SCRIPT);
|
|
||||||
+ current_entryno = saved_current_entryno;
|
|
||||||
+ saved_entryno &= 0x3fff;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+#endif /* SUPPORT_DISKLESS */
|
|
||||||
+
|
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
|
||||||
/* device */
|
|
||||||
--- grub-0.96/stage2/stage2.c~ 2004-07-24 20:53:47.000000000 +0200
|
|
||||||
+++ grub-0.96/stage2/stage2.c 2005-09-02 14:45:04.000000000 +0200
|
|
||||||
@@ -827,6 +827,7 @@
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
+extern void __savedefault_once_reset();
|
|
||||||
|
|
||||||
/* This is the starting function in C. */
|
|
||||||
void
|
|
||||||
@@ -1048,7 +1049,9 @@
|
|
||||||
}
|
|
||||||
while (is_preset);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+#ifndef SUPPORT_DISKLESS
|
|
||||||
+ __savedefault_once_reset();
|
|
||||||
+#endif
|
|
||||||
if (! num_entries)
|
|
||||||
{
|
|
||||||
/* If no acceptable config file, goto command-line, starting
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
--- grub-0.95/stage2/builtins.c.orig 2004-05-14 21:30:52.000000000 +0200
|
|
||||||
+++ grub-0.95/stage2/builtins.c 2005-03-02 17:01:27.568051824 +0100
|
|
||||||
@@ -3884,6 +3884,9 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* force buffer cache invalidation after embedding */
|
|
||||||
+ buf_drive = -1;
|
|
||||||
+
|
|
||||||
/* Construct a string that is used by the command "install" as its
|
|
||||||
arguments. */
|
|
||||||
sprint_device (installed_drive, installed_partition);
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
diff -ru ../grub-0.97-save/docs/grub.8 ./docs/grub.8
|
|
||||||
--- ../grub-0.97-save/docs/grub.8 2005-05-08 04:48:56.000000000 +0200
|
|
||||||
+++ ./docs/grub.8 2006-09-18 21:26:18.800377712 +0200
|
|
||||||
@@ -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
|
|
||||||
diff -ru ../grub-0.97-save/docs/grub.texi ./docs/grub.texi
|
|
||||||
--- ../grub-0.97-save/docs/grub.texi 2006-09-16 21:29:53.000000000 +0200
|
|
||||||
+++ ./docs/grub.texi 2006-09-18 21:29:54.573575200 +0200
|
|
||||||
@@ -687,7 +687,7 @@
|
|
||||||
For booting from a CD-ROM, GRUB uses a special Stage 2 called
|
|
||||||
@file{stage2_eltorito}. The only GRUB files you need to have in your
|
|
||||||
bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file
|
|
||||||
-@file{menu.lst}. You don't need to use @file{stage1} or @file{stage2},
|
|
||||||
+@file{grub.conf}. You don't need to use @file{stage1} or @file{stage2},
|
|
||||||
because El Torito is quite different from the standard boot process.
|
|
||||||
|
|
||||||
Here is an example of procedures to make a bootable CD-ROM
|
|
||||||
@@ -710,7 +710,7 @@
|
|
||||||
$ @kbd{cp /usr/share/grub/i386-pc/stage2_eltorito iso/boot/grub}
|
|
||||||
@end example
|
|
||||||
|
|
||||||
-If desired, make the config file @file{menu.lst} under @file{iso/boot/grub}
|
|
||||||
+If desired, make the config file @file{grub.conf} under @file{iso/boot/grub}
|
|
||||||
(@pxref{Configuration}), and copy any files and directories for the disc to the
|
|
||||||
directory @file{iso/}.
|
|
||||||
|
|
||||||
@@ -1265,7 +1265,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
|
|
||||||
@@ -1538,7 +1538,7 @@
|
|
||||||
foo:ht=1:ha=63655d0334a7:ip=145.71.35.127:\
|
|
||||||
:bf=/nbgrub:\
|
|
||||||
:tc=.allhost:\
|
|
||||||
- :T150="(nd)/tftpboot/menu.lst.foo":
|
|
||||||
+ :T150="(nd)/tftpboot/grub.conf.foo":
|
|
||||||
@end group
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@@ -1882,8 +1882,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
|
|
||||||
@@ -3559,7 +3559,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}
|
|
||||||
diff -ru ../grub-0.97-save/grub/asmstub.c ./grub/asmstub.c
|
|
||||||
--- ../grub-0.97-save/grub/asmstub.c 2006-09-16 21:29:52.000000000 +0200
|
|
||||||
+++ ./grub/asmstub.c 2006-09-18 21:31:08.793292088 +0200
|
|
||||||
@@ -73,7 +73,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;
|
|
||||||
diff -ru ../grub-0.97-save/stage1/Makefile.am ./stage1/Makefile.am
|
|
||||||
--- ../grub-0.97-save/stage1/Makefile.am 2006-09-16 21:29:52.000000000 +0200
|
|
||||||
+++ ./stage1/Makefile.am 2006-09-18 21:09:46.550222664 +0200
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-pkglibdir = /usr/lib/grub
|
|
||||||
+pkglibdir = /usr/share/grub/i386-pc
|
|
||||||
nodist_pkglib_DATA = stage1
|
|
||||||
|
|
||||||
CLEANFILES = $(nodist_pkglib_DATA)
|
|
||||||
#diff -ru ../grub-0.97-save/stage1/Makefile.in ./stage1/Makefile.in
|
|
||||||
#--- ../grub-0.97-save/stage1/Makefile.in 2006-09-16 21:30:10.000000000 +0200
|
|
||||||
#+++ ./stage1/Makefile.in 2006-09-18 21:10:36.337653824 +0200
|
|
||||||
#@@ -66,7 +66,7 @@
|
|
||||||
# ETAGS = etags
|
|
||||||
# CTAGS = ctags
|
|
||||||
# DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
#-pkglibdir = /usr/lib/grub
|
|
||||||
#+pkglibdir = /usr/share/grub/i386-pc
|
|
||||||
# ACLOCAL = @ACLOCAL@
|
|
||||||
# AMDEP_FALSE = @AMDEP_FALSE@
|
|
||||||
# AMDEP_TRUE = @AMDEP_TRUE@
|
|
||||||
diff -ru ../grub-0.97-save/stage2/Makefile.am ./stage2/Makefile.am
|
|
||||||
--- ../grub-0.97-save/stage2/Makefile.am 2006-09-16 21:29:52.000000000 +0200
|
|
||||||
+++ ./stage2/Makefile.am 2006-09-18 21:11:46.148041032 +0200
|
|
||||||
@@ -27,7 +27,7 @@
|
|
||||||
-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
|
|
||||||
|
|
||||||
# Stage 2 and Stage 1.5's.
|
|
||||||
-pkglibdir = /usr/lib/grub
|
|
||||||
+pkglibdir = /usr/share/grub/i386-pc
|
|
||||||
|
|
||||||
EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec
|
|
||||||
|
|
||||||
#diff -ru ../grub-0.97-save/stage2/Makefile.in ./stage2/Makefile.in
|
|
||||||
#--- ../grub-0.97-save/stage2/Makefile.in 2006-09-16 21:30:12.000000000 +0200
|
|
||||||
#+++ ./stage2/Makefile.in 2006-09-18 21:12:09.087553696 +0200
|
|
||||||
#@@ -442,7 +442,7 @@
|
|
||||||
# DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
#
|
|
||||||
# # Stage 2 and Stage 1.5's.
|
|
||||||
#-pkglibdir = /usr/lib/grub
|
|
||||||
#+pkglibdir = /usr/share/grub/i386-pc
|
|
||||||
# ACLOCAL = @ACLOCAL@
|
|
||||||
# AMDEP_FALSE = @AMDEP_FALSE@
|
|
||||||
# AMDEP_TRUE = @AMDEP_TRUE@
|
|
||||||
diff -ru ../grub-0.97-save/stage2/asm.S ./stage2/asm.S
|
|
||||||
--- ../grub-0.97-save/stage2/asm.S 2006-09-16 21:29:52.000000000 +0200
|
|
||||||
+++ ./stage2/asm.S 2006-09-18 21:31:53.404510152 +0200
|
|
||||||
@@ -98,7 +98,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"
|
|
||||||
diff -ru ../grub-0.97-save/stage2/builtins.c ./stage2/builtins.c
|
|
||||||
--- ../grub-0.97-save/stage2/builtins.c 2006-09-16 21:29:52.000000000 +0200
|
|
||||||
+++ ./stage2/builtins.c 2006-09-18 21:32:39.562493072 +0200
|
|
||||||
@@ -4022,7 +4022,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. */
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
Fread doesn't return -1 on error, so use ferror().
|
|
||||||
|
|
||||||
--- util/mbchk.c.old Tue Jan 22 18:36:17 2002
|
|
||||||
+++ util/mbchk.c Tue Jan 22 18:28:54 2002
|
|
||||||
@@ -59,7 +59,9 @@ check_multiboot (const char *filename, F
|
|
||||||
int i;
|
|
||||||
char buf[8192];
|
|
||||||
|
|
||||||
- if (fread (buf, 1, 8192, fp) < 0)
|
|
||||||
+ fread (buf, 1, 8192, fp);
|
|
||||||
+
|
|
||||||
+ if (ferror(fp))
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: Read error.\n", filename);
|
|
||||||
return 0;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
borrowed from fedora
|
|
||||||
enlarge window buffer to avoid accessing beyond end-of-buffer
|
|
||||||
|
|
||||||
--- gzip-1.3.3/gzip.c.orig Thu Jan 30 21:19:36 2003
|
|
||||||
+++ gzip-1.3.3/gzip.c Thu Jan 30 21:09:52 2003
|
|
||||||
@@ -198,7 +198,7 @@
|
|
||||||
DECLARE(uch, inbuf, INBUFSIZ +INBUF_EXTRA);
|
|
||||||
DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA);
|
|
||||||
DECLARE(ush, d_buf, DIST_BUFSIZE);
|
|
||||||
-DECLARE(uch, window, 2L*WSIZE);
|
|
||||||
+DECLARE(uch, window, 2L*WSIZE + 4096);
|
|
||||||
#ifndef MAXSEG_64K
|
|
||||||
DECLARE(ush, tab_prefix, 1L<<BITS);
|
|
||||||
#else
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
borrowed from fedora
|
|
||||||
make stack in match.S nonexecutable
|
|
||||||
|
|
||||||
--- gzip-1.3.5/match.c.execstack 2002-09-30 09:21:35.000000000 +0200
|
|
||||||
+++ gzip-1.3.5/match.c 2005-03-22 10:40:37.739640958 +0100
|
|
||||||
@@ -54,6 +54,9 @@
|
|
||||||
.globl _match_init
|
|
||||||
.globl _longest_match
|
|
||||||
|
|
||||||
+ .section .note.GNU-stack, "", @progbits
|
|
||||||
+ .previous
|
|
||||||
+
|
|
||||||
.text
|
|
||||||
|
|
||||||
_match_init:
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
fix CAN-2005-1228 directory traversal bug
|
|
||||||
borrowed from fedora
|
|
||||||
|
|
||||||
--- gzip-1.3.5/gzip.c.pom 2005-04-29 14:25:23.000000000 +0200
|
|
||||||
+++ gzip-1.3.5/gzip.c 2005-04-29 14:24:42.000000000 +0200
|
|
||||||
@@ -1344,6 +1344,8 @@
|
|
||||||
error("corrupted input -- file name too large");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ char *base2 = base_name (base); /* there should be problem with file name */
|
|
||||||
+ strcpy(base, base2); /* in this name there can't be path */
|
|
||||||
/* If necessary, adapt the name to local OS conventions: */
|
|
||||||
if (!list) {
|
|
||||||
MAKE_LEGAL_NAME(base);
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
fix CAN-2005-0988 race condition when setting file permissions
|
|
||||||
borrowed from fedora
|
|
||||||
|
|
||||||
--- gzip-1.3.5/gzip.c.perm 2005-04-26 14:22:58.211395152 +0200
|
|
||||||
+++ gzip-1.3.5/gzip.c 2005-04-26 14:24:10.414418624 +0200
|
|
||||||
@@ -881,6 +881,20 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
close(ifd);
|
|
||||||
+ /* ofd ownership and permissions have to be set before close(ofd)*/
|
|
||||||
+ if (!to_stdout) {
|
|
||||||
+ if (fchmod(ofd, istat.st_mode & 07777)) {
|
|
||||||
+ int e = errno;
|
|
||||||
+ WARN((stderr, "%s: ", progname));
|
|
||||||
+ if (!quiet) {
|
|
||||||
+ errno = e;
|
|
||||||
+ perror(ofname);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#ifndef NO_CHOWN
|
|
||||||
+ fchown(ofd, istat.st_uid, istat.st_gid); /* Copy ownership */
|
|
||||||
+#endif
|
|
||||||
+ }
|
|
||||||
if (!to_stdout && close(ofd)) {
|
|
||||||
write_error();
|
|
||||||
}
|
|
||||||
@@ -902,7 +916,7 @@
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
}
|
|
||||||
- /* Copy modes, times, ownership, and remove the input file */
|
|
||||||
+ /* Copy times and remove the input file */
|
|
||||||
if (!to_stdout) {
|
|
||||||
copy_stat(&istat);
|
|
||||||
}
|
|
||||||
@@ -1715,7 +1729,7 @@
|
|
||||||
|
|
||||||
|
|
||||||
/* ========================================================================
|
|
||||||
- * Copy modes, times, ownership from input file to output file.
|
|
||||||
+ * Copy times from input file to output file.
|
|
||||||
* IN assertion: to_stdout is false.
|
|
||||||
*/
|
|
||||||
local void copy_stat(ifstat)
|
|
||||||
@@ -1730,18 +1744,6 @@
|
|
||||||
}
|
|
||||||
reset_times(ofname, ifstat);
|
|
||||||
#endif
|
|
||||||
- /* Copy the protection modes */
|
|
||||||
- if (chmod(ofname, ifstat->st_mode & 07777)) {
|
|
||||||
- int e = errno;
|
|
||||||
- WARN((stderr, "%s: ", progname));
|
|
||||||
- if (!quiet) {
|
|
||||||
- errno = e;
|
|
||||||
- perror(ofname);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-#ifndef NO_CHOWN
|
|
||||||
- chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
|
|
||||||
-#endif
|
|
||||||
remove_ofname = 0;
|
|
||||||
/* It's now safe to remove the input file: */
|
|
||||||
if (xunlink (ifname)) {
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
Submitted By: Greg Schafer <gschafer at zip dot com dot au>
|
|
||||||
Date: 2003-12-11
|
|
||||||
Initial Package Version: 1.4.2
|
|
||||||
Origin: Greg Schafer
|
|
||||||
Description: Prevent installation of unwanted server man pages.
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/ftpd/Makefile.in inetutils-1.4.2/ftpd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/ftpd/Makefile.in 2002-12-23 04:30:12.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/ftpd/Makefile.in 2003-12-11 02:21:24.222010104 +0000
|
|
||||||
@@ -177,7 +177,6 @@
|
|
||||||
|
|
||||||
noinst_HEADERS = extern.h
|
|
||||||
|
|
||||||
-man_MANS = ftpd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_FTPWELCOME) $(PATHDEF_FTPUSERS) \
|
|
||||||
$(PATHDEF_FTPLOGINMESG) $(PATHDEF_FTPCHROOT) $(PATHDEF_FTPDPID) \
|
|
||||||
diff -Naur inetutils-1.4.2.orig/inetd/Makefile.in inetutils-1.4.2/inetd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/inetd/Makefile.in 2002-12-23 04:30:13.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/inetd/Makefile.in 2003-12-11 02:21:24.223009952 +0000
|
|
||||||
@@ -172,7 +172,6 @@
|
|
||||||
|
|
||||||
inetd_SOURCES = inetd.c
|
|
||||||
|
|
||||||
-man_MANS = inetd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_INETDCONF) $(PATHDEF_INETDDIR) -I$(top_builddir)/include
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/logger/Makefile.in inetutils-1.4.2/logger/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/logger/Makefile.in 2002-12-23 04:30:16.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/logger/Makefile.in 2003-12-11 02:21:24.224009800 +0000
|
|
||||||
@@ -175,7 +175,6 @@
|
|
||||||
|
|
||||||
logger_SOURCES = logger.c
|
|
||||||
|
|
||||||
-man_MANS = logger.1
|
|
||||||
|
|
||||||
EXTRA_DIST = $(man_MANS)
|
|
||||||
subdir = logger
|
|
||||||
diff -Naur inetutils-1.4.2.orig/rexecd/Makefile.in inetutils-1.4.2/rexecd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/rexecd/Makefile.in 2002-12-23 04:30:17.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/rexecd/Makefile.in 2003-12-11 02:21:24.225009648 +0000
|
|
||||||
@@ -173,7 +173,6 @@
|
|
||||||
|
|
||||||
rexecd_SOURCES = rexecd.c
|
|
||||||
|
|
||||||
-man_MANS = rexecd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_DEFPATH) $(PATHDEF_BSHELL) -I$(top_builddir)/include
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/rlogind/Makefile.in inetutils-1.4.2/rlogind/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/rlogind/Makefile.in 2002-12-23 04:30:18.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/rlogind/Makefile.in 2003-12-11 02:21:24.225009648 +0000
|
|
||||||
@@ -173,7 +173,6 @@
|
|
||||||
|
|
||||||
rlogind_SOURCES = rlogind.c
|
|
||||||
|
|
||||||
-man_MANS = rlogind.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_DEV) $(PATHDEF_LOGIN) -I$(top_builddir)/include
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/rshd/Makefile.in inetutils-1.4.2/rshd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/rshd/Makefile.in 2002-12-23 04:30:19.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/rshd/Makefile.in 2003-12-11 02:21:24.226009496 +0000
|
|
||||||
@@ -172,7 +172,6 @@
|
|
||||||
|
|
||||||
rshd_SOURCES = rshd.c
|
|
||||||
|
|
||||||
-man_MANS = rshd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_BSHELL) $(PATHDEF_NOLOGIN) $(PATHDEF_DEFPATH) -I$(top_builddir)/include
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/syslogd/Makefile.in inetutils-1.4.2/syslogd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/syslogd/Makefile.in 2002-12-23 04:30:19.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/syslogd/Makefile.in 2003-12-11 02:21:24.226009496 +0000
|
|
||||||
@@ -172,7 +172,6 @@
|
|
||||||
|
|
||||||
syslogd_SOURCES = syslogd.c
|
|
||||||
|
|
||||||
-man_MANS = syslog.conf.5 syslogd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_LOG) $(PATHDEF_LOGCONF) $(PATHDEF_LOGPID) \
|
|
||||||
$(PATHDEF_CONSOLE) -I$(top_builddir)/include
|
|
||||||
diff -Naur inetutils-1.4.2.orig/talkd/Makefile.in inetutils-1.4.2/talkd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/talkd/Makefile.in 2002-12-23 04:30:20.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/talkd/Makefile.in 2003-12-11 02:21:24.227009344 +0000
|
|
||||||
@@ -180,7 +180,6 @@
|
|
||||||
intalkd.h
|
|
||||||
|
|
||||||
|
|
||||||
-man_MANS = talkd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_DEV) -I${top_srcdir}/libinetutils -I$(top_builddir)/include
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/telnetd/Makefile.in inetutils-1.4.2/telnetd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/telnetd/Makefile.in 2002-12-23 04:30:21.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/telnetd/Makefile.in 2003-12-11 02:21:24.228009192 +0000
|
|
||||||
@@ -176,7 +176,6 @@
|
|
||||||
|
|
||||||
noinst_HEADERS = telnetd.h
|
|
||||||
|
|
||||||
-man_MANS = telnetd.8
|
|
||||||
|
|
||||||
INCLUDES = $(PATHDEF_DEV) $(PATHDEF_TTY) $(PATHDEF_LOGIN) -I$(top_builddir)/include \
|
|
||||||
-I$(top_srcdir) @INCAUTH@
|
|
||||||
diff -Naur inetutils-1.4.2.orig/tftpd/Makefile.in inetutils-1.4.2/tftpd/Makefile.in
|
|
||||||
--- inetutils-1.4.2.orig/tftpd/Makefile.in 2002-12-23 04:30:22.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/tftpd/Makefile.in 2003-12-11 02:21:24.229009040 +0000
|
|
||||||
@@ -174,7 +174,6 @@
|
|
||||||
|
|
||||||
tftpd_SOURCES = tftpd.c
|
|
||||||
|
|
||||||
-man_MANS = tftpd.8
|
|
||||||
|
|
||||||
LDADD = -L../libinetutils -linetutils
|
|
||||||
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
Submitted By: Jim Gifford (patches at jg555 dot com)
|
|
||||||
Date: 2003-09-10
|
|
||||||
Initial Package Version: 1.4.2
|
|
||||||
Origin: inetutils CVS
|
|
||||||
Description: Fixes Ping Errors
|
|
||||||
If you try to only send one ping, it will not stop
|
|
||||||
until it gets a response.
|
|
||||||
|
|
||||||
diff -Naur inetutils-1.4.2.orig/ping/ping.c inetutils-1.4.2/ping/ping.c
|
|
||||||
--- inetutils-1.4.2.orig/ping/ping.c 2002-12-11 12:38:00.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/ping/ping.c 2003-09-10 16:13:14.000000000 +0000
|
|
||||||
@@ -338,7 +338,8 @@
|
|
||||||
struct timeval last, intvl, now;
|
|
||||||
struct timeval *t = NULL;
|
|
||||||
int finishing = 0;
|
|
||||||
-
|
|
||||||
+ int nresp = 0;
|
|
||||||
+
|
|
||||||
signal (SIGINT, sig_int);
|
|
||||||
|
|
||||||
fdmax = ping->ping_fd+1;
|
|
||||||
@@ -387,23 +388,24 @@
|
|
||||||
if ((n = select (fdmax, &fdset, NULL, NULL, &timeout)) < 0)
|
|
||||||
{
|
|
||||||
if (errno != EINTR)
|
|
||||||
- perror ("ping: select");
|
|
||||||
+ perror ("select");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (n == 1)
|
|
||||||
{
|
|
||||||
- len = ping_recv (ping);
|
|
||||||
+ if (ping_recv (ping) == 0)
|
|
||||||
+ nresp++;
|
|
||||||
if (t == 0)
|
|
||||||
{
|
|
||||||
gettimeofday (&now, NULL);
|
|
||||||
t = &now;
|
|
||||||
}
|
|
||||||
- if (ping->ping_count && ping->ping_num_recv >= ping->ping_count)
|
|
||||||
+ if (ping->ping_count && nresp >= ping->ping_count)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- if (!ping->ping_count || ping->ping_num_recv < ping->ping_count)
|
|
||||||
+ if (!ping->ping_count || ping->ping_num_xmit < ping->ping_count)
|
|
||||||
{
|
|
||||||
send_echo (ping);
|
|
||||||
if (!(options & OPT_QUIET) && options & OPT_FLOOD)
|
|
||||||
@@ -414,7 +416,7 @@
|
|
||||||
else if (finishing)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
- {
|
|
||||||
+ {
|
|
||||||
finishing = 1;
|
|
||||||
|
|
||||||
intvl.tv_sec = MAXWAIT;
|
|
||||||
diff -Naur inetutils-1.4.2.orig/ping/ping_echo.c inetutils-1.4.2/ping/ping_echo.c
|
|
||||||
--- inetutils-1.4.2.orig/ping/ping_echo.c 2002-06-26 03:15:06.000000000 +0000
|
|
||||||
+++ inetutils-1.4.2/ping/ping_echo.c 2003-09-10 16:19:11.000000000 +0000
|
|
||||||
@@ -43,7 +43,6 @@
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
-#include <math.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include "getopt.h"
|
|
||||||
@@ -583,6 +582,31 @@
|
|
||||||
out->tv_sec -= in->tv_sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
+double
|
|
||||||
+nabs (double a)
|
|
||||||
+{
|
|
||||||
+ return (a < 0) ? -a : a;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+double
|
|
||||||
+nsqrt (double a, double prec)
|
|
||||||
+{
|
|
||||||
+ double x0, x1;
|
|
||||||
+
|
|
||||||
+ if (a < 0)
|
|
||||||
+ return 0;
|
|
||||||
+ if (a < prec)
|
|
||||||
+ return 0;
|
|
||||||
+ x1 = a/2;
|
|
||||||
+ do
|
|
||||||
+ {
|
|
||||||
+ x0 = x1;
|
|
||||||
+ x1 = (x0 + a/x0) / 2;
|
|
||||||
+ }
|
|
||||||
+ while (nabs (x1 - x0) > prec);
|
|
||||||
+
|
|
||||||
+ return x1;
|
|
||||||
+}
|
|
||||||
|
|
||||||
int
|
|
||||||
echo_finish ()
|
|
||||||
@@ -596,10 +620,10 @@
|
|
||||||
double vari = ping_stat->tsumsq / total - avg * avg;
|
|
||||||
|
|
||||||
printf ("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n",
|
|
||||||
- ping_stat->tmin,
|
|
||||||
- avg,
|
|
||||||
- ping_stat->tmax,
|
|
||||||
- sqrt (vari));
|
|
||||||
+ ping_stat->tmin,
|
|
||||||
+ avg,
|
|
||||||
+ ping_stat->tmax,
|
|
||||||
+ nsqrt (vari, 0.0005));
|
|
||||||
}
|
|
||||||
exit (ping->ping_num_recv == 0);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
--- iproute2/lib/libnetlink.c.orig 2003-08-10 15:02:10.000000000 +1000
|
|
||||||
+++ iproute2/lib/libnetlink.c 2003-10-13 19:36:41.000000000 +1000
|
|
||||||
@@ -169,7 +169,8 @@
|
|
||||||
while (NLMSG_OK(h, status)) {
|
|
||||||
int err;
|
|
||||||
|
|
||||||
- if (h->nlmsg_pid != rth->local.nl_pid ||
|
|
||||||
+ if (nladdr.nl_pid != 0 ||
|
|
||||||
+ h->nlmsg_pid != rth->local.nl_pid ||
|
|
||||||
h->nlmsg_seq != rth->dump) {
|
|
||||||
if (junk) {
|
|
||||||
err = junk(&nladdr, h, arg2);
|
|
||||||
@@ -277,7 +278,8 @@
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (h->nlmsg_pid != rtnl->local.nl_pid ||
|
|
||||||
+ if (nladdr.nl_pid != peer ||
|
|
||||||
+ h->nlmsg_pid != rtnl->local.nl_pid ||
|
|
||||||
h->nlmsg_seq != seq) {
|
|
||||||
if (junk) {
|
|
||||||
err = junk(&nladdr, h, jarg);
|
|
||||||
@@ -1,251 +0,0 @@
|
|||||||
diff -ruN iproute2.old/Makefile iproute2/Makefile
|
|
||||||
--- iproute2.old/Makefile Thu Aug 2 08:37:03 2001
|
|
||||||
+++ iproute2/Makefile Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -18,14 +18,14 @@
|
|
||||||
#options for ipx
|
|
||||||
ADDLIB+=ipx_ntop.o ipx_pton.o
|
|
||||||
|
|
||||||
-ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
|
|
||||||
- ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
|
|
||||||
- GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
|
|
||||||
- endif
|
|
||||||
-endif
|
|
||||||
-ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h))
|
|
||||||
- GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
|
|
||||||
-endif
|
|
||||||
+#ifeq ($(LIBC_INCLUDE)/socketbits.h,$(wildcard $(LIBC_INCLUDE)/socketbits.h))
|
|
||||||
+# ifeq ($(LIBC_INCLUDE)/net/if_packet.h,$(wildcard $(LIBC_INCLUDE)/net/if_packet.h))
|
|
||||||
+# GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
|
|
||||||
+# endif
|
|
||||||
+#endif
|
|
||||||
+#ifeq ($(LIBC_INCLUDE)/bits/socket.h,$(wildcard $(LIBC_INCLUDE)/bits/socket.h))
|
|
||||||
+# GLIBCFIX=-I../include-glibc -include ../include-glibc/glibc-bugs.h
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -Werror -g
|
|
||||||
diff -ruN iproute2.old/include/utils.h iproute2/include/utils.h
|
|
||||||
--- iproute2.old/include/utils.h Sun Apr 16 19:42:50 2000
|
|
||||||
+++ iproute2/include/utils.h Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -3,8 +3,9 @@
|
|
||||||
|
|
||||||
#include <asm/types.h>
|
|
||||||
#include <asm/bitops.h>
|
|
||||||
+#include <netinet/in.h>
|
|
||||||
#include <linux/inetdevice.h>
|
|
||||||
-#include <resolv.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
|
|
||||||
#include "libnetlink.h"
|
|
||||||
#include "ll_map.h"
|
|
||||||
diff -ruN iproute2.old/ip/ipaddress.c iproute2/ip/ipaddress.c
|
|
||||||
--- iproute2.old/ip/ipaddress.c Thu Aug 23 06:07:46 2001
|
|
||||||
+++ iproute2/ip/ipaddress.c Mon Dec 1 22:31:20 2003
|
|
||||||
@@ -23,8 +23,6 @@
|
|
||||||
#include <linux/netdevice.h>
|
|
||||||
#include <linux/if_arp.h>
|
|
||||||
#include <linux/sockios.h>
|
|
||||||
-#include <netinet/in.h>
|
|
||||||
-#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <fnmatch.h>
|
|
||||||
|
|
||||||
diff -ruN iproute2.old/ip/ipmaddr.c iproute2/ip/ipmaddr.c
|
|
||||||
--- iproute2.old/ip/ipmaddr.c Sun Apr 16 19:42:51 2000
|
|
||||||
+++ iproute2/ip/ipmaddr.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -21,12 +21,10 @@
|
|
||||||
#include <linux/if.h>
|
|
||||||
#include <linux/if_arp.h>
|
|
||||||
#include <linux/sockios.h>
|
|
||||||
-#include <netinet/in.h>
|
|
||||||
-#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
|
|
||||||
static struct {
|
|
||||||
char *dev;
|
|
||||||
diff -ruN iproute2.old/ip/ipmroute.c iproute2/ip/ipmroute.c
|
|
||||||
--- iproute2.old/ip/ipmroute.c Fri Aug 24 19:19:20 2001
|
|
||||||
+++ iproute2/ip/ipmroute.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -21,8 +21,6 @@
|
|
||||||
#include <linux/if.h>
|
|
||||||
#include <linux/if_arp.h>
|
|
||||||
#include <linux/sockios.h>
|
|
||||||
-#include <netinet/in.h>
|
|
||||||
-#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
diff -ruN iproute2.old/ip/ipneigh.c iproute2/ip/ipneigh.c
|
|
||||||
--- iproute2.old/ip/ipneigh.c Sun Apr 16 19:42:51 2000
|
|
||||||
+++ iproute2/ip/ipneigh.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -26,8 +26,8 @@
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
#include "ip_common.h"
|
|
||||||
|
|
||||||
#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
|
|
||||||
diff -ruN iproute2.old/ip/iproute.c iproute2/ip/iproute.c
|
|
||||||
--- iproute2.old/ip/iproute.c Mon Aug 6 02:31:52 2001
|
|
||||||
+++ iproute2/ip/iproute.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -28,8 +28,8 @@
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <linux/in_route.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
#include "ip_common.h"
|
|
||||||
|
|
||||||
#ifndef RTAX_RTTVAR
|
|
||||||
diff -ruN iproute2.old/ip/iprule.c iproute2/ip/iprule.c
|
|
||||||
--- iproute2.old/ip/iprule.c Thu Aug 2 05:43:29 2001
|
|
||||||
+++ iproute2/ip/iprule.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -25,8 +25,8 @@
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
|
|
||||||
static void usage(void) __attribute__((noreturn));
|
|
||||||
|
|
||||||
diff -ruN iproute2.old/ip/rtacct.c iproute2/ip/rtacct.c
|
|
||||||
--- iproute2.old/ip/rtacct.c Sun Apr 16 19:42:51 2000
|
|
||||||
+++ iproute2/ip/rtacct.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -19,7 +19,9 @@
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <net/if.h>
|
|
||||||
#include <string.h>
|
|
||||||
+#include <netinet/in.h>
|
|
||||||
|
|
||||||
+#include "utils.h"
|
|
||||||
#include "rt_names.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
diff -ruN iproute2.old/ip/rtm_map.c iproute2/ip/rtm_map.c
|
|
||||||
--- iproute2.old/ip/rtm_map.c Sun Apr 16 19:42:51 2000
|
|
||||||
+++ iproute2/ip/rtm_map.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -19,8 +19,8 @@
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
|
|
||||||
char *rtnl_rtntype_n2a(int id, char *buf, int len)
|
|
||||||
{
|
|
||||||
diff -ruN iproute2.old/lib/dnet_ntop.c iproute2/lib/dnet_ntop.c
|
|
||||||
--- iproute2.old/lib/dnet_ntop.c Sun Apr 16 19:42:52 2000
|
|
||||||
+++ iproute2/lib/dnet_ntop.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
diff -ruN iproute2.old/lib/ll_proto.c iproute2/lib/ll_proto.c
|
|
||||||
--- iproute2.old/lib/ll_proto.c Thu Aug 2 04:41:41 2001
|
|
||||||
+++ iproute2/lib/ll_proto.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -20,8 +20,6 @@
|
|
||||||
#include <linux/netdevice.h>
|
|
||||||
#include <linux/if_arp.h>
|
|
||||||
#include <linux/sockios.h>
|
|
||||||
-#include <netinet/in.h>
|
|
||||||
-#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
diff -ruN iproute2.old/lib/ll_types.c iproute2/lib/ll_types.c
|
|
||||||
--- iproute2.old/lib/ll_types.c Thu Aug 2 05:18:33 2001
|
|
||||||
+++ iproute2/lib/ll_types.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -9,6 +9,7 @@
|
|
||||||
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
@@ -16,12 +17,9 @@
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
-#include <sys/ioctl.h>
|
|
||||||
#include <linux/netdevice.h>
|
|
||||||
#include <linux/if_arp.h>
|
|
||||||
#include <linux/sockios.h>
|
|
||||||
-#include <netinet/in.h>
|
|
||||||
-#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char * ll_type_n2a(int type, char *buf, int len)
|
|
||||||
diff -ruN iproute2.old/lib/rt_names.c iproute2/lib/rt_names.c
|
|
||||||
--- iproute2.old/lib/rt_names.c Sun Apr 16 19:42:52 2000
|
|
||||||
+++ iproute2/lib/rt_names.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -16,6 +16,7 @@
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
+#include <asm/types.h>
|
|
||||||
|
|
||||||
static void rtnl_tab_initialize(char *file, char **tab, int size)
|
|
||||||
{
|
|
||||||
diff -ruN iproute2.old/lib/utils.c iproute2/lib/utils.c
|
|
||||||
--- iproute2.old/lib/utils.c Fri Aug 24 19:09:54 2001
|
|
||||||
+++ iproute2/lib/utils.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -25,7 +25,6 @@
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <resolv.h>
|
|
||||||
-#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
diff -ruN iproute2.old/tc/f_rsvp.c iproute2/tc/f_rsvp.c
|
|
||||||
--- iproute2.old/tc/f_rsvp.c Thu Aug 2 06:19:40 2001
|
|
||||||
+++ iproute2/tc/f_rsvp.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -20,8 +20,8 @@
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
#include "tc_util.h"
|
|
||||||
|
|
||||||
static void explain(void)
|
|
||||||
diff -ruN iproute2.old/tc/q_htb.c iproute2/tc/q_htb.c
|
|
||||||
--- iproute2.old/tc/q_htb.c Mon Dec 1 22:30:53 2003
|
|
||||||
+++ iproute2/tc/q_htb.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -19,6 +19,7 @@
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <string.h>
|
|
||||||
+#include <linux/param.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
#include "tc_util.h"
|
|
||||||
diff -ruN iproute2.old/tc/tc_filter.c iproute2/tc/tc_filter.c
|
|
||||||
--- iproute2.old/tc/tc_filter.c Fri Aug 24 19:19:19 2001
|
|
||||||
+++ iproute2/tc/tc_filter.c Mon Dec 1 22:31:11 2003
|
|
||||||
@@ -23,8 +23,8 @@
|
|
||||||
#include <string.h>
|
|
||||||
#include <linux/if_ether.h>
|
|
||||||
|
|
||||||
-#include "rt_names.h"
|
|
||||||
#include "utils.h"
|
|
||||||
+#include "rt_names.h"
|
|
||||||
#include "tc_util.h"
|
|
||||||
#include "tc_common.h"
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
Index: iptables.c
|
|
||||||
===================================================================
|
|
||||||
RCS file: /cvspublic/iptables/iptables.c,v
|
|
||||||
retrieving revision 1.68
|
|
||||||
retrieving revision 1.71
|
|
||||||
diff -u -r1.68 -r1.71
|
|
||||||
--- iptables.c 26 May 2004 16:04:48 -0000 1.68
|
|
||||||
+++ iptables.c 30 Aug 2004 16:00:09 -0000 1.71
|
|
||||||
@@ -551,7 +551,7 @@
|
|
||||||
|
|
||||||
while (host->h_addr_list[*naddr] != (char *) NULL)
|
|
||||||
(*naddr)++;
|
|
||||||
- addr = fw_calloc(*naddr, sizeof(struct in_addr));
|
|
||||||
+ addr = fw_calloc(*naddr, sizeof(struct in_addr) * *naddr);
|
|
||||||
for (i = 0; i < *naddr; i++)
|
|
||||||
inaddrcpy(&(addr[i]),
|
|
||||||
(struct in_addr *) host->h_addr_list[i]);
|
|
||||||
@@ -2339,11 +2339,8 @@
|
|
||||||
e = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (c = 0; c < nsaddrs; c++)
|
|
||||||
- free(&saddrs[c]);
|
|
||||||
-
|
|
||||||
- for (c = 0; c < ndaddrs; c++)
|
|
||||||
- free(&daddrs[c]);
|
|
||||||
+ free(saddrs);
|
|
||||||
+ free(daddrs);
|
|
||||||
|
|
||||||
if (opts != original_opts) {
|
|
||||||
free(opts);
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,37 +0,0 @@
|
|||||||
diff -ruN kudzu-0.99.50.old/updfstab.c kudzu-0.99.50/updfstab.c
|
|
||||||
--- kudzu-0.99.50.old/updfstab.c Mon Apr 8 05:37:01 2002
|
|
||||||
+++ kudzu-0.99.50/updfstab.c Tue Dec 16 15:22:26 2003
|
|
||||||
@@ -688,33 +688,6 @@
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* do this before moving onto /etc/fstab; this keeps magicdev
|
|
||||||
- from noticing the change before the permissions are correct */
|
|
||||||
-
|
|
||||||
- pid = fork();
|
|
||||||
- if (!pid) {
|
|
||||||
- execl("/sbin/pam_console_apply", "/sbin/pam_console_apply",
|
|
||||||
- "-f", revokeFileName, "-r", NULL);
|
|
||||||
- printf("failed\n");
|
|
||||||
- exit(-1);
|
|
||||||
- }
|
|
||||||
- waitpid(pid, &status, 0);
|
|
||||||
-
|
|
||||||
- if (!WIFEXITED(status) || WEXITSTATUS(status))
|
|
||||||
- fprintf(stderr, _("/sbin/pam_console_apply -r failed\n"));
|
|
||||||
-
|
|
||||||
- pid = fork();
|
|
||||||
- if (!pid) {
|
|
||||||
- execl("/sbin/pam_console_apply", "/sbin/pam_console_apply",
|
|
||||||
- "-f", outputFileName, NULL);
|
|
||||||
- printf("failed\n");
|
|
||||||
- exit(-1);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- waitpid(pid, &status, 0);
|
|
||||||
- if (!WIFEXITED(status) || WEXITSTATUS(status))
|
|
||||||
- fprintf(stderr, _("/sbin/pam_console_apply failed\n"));
|
|
||||||
-
|
|
||||||
if (rename(outputFileName, fileName)) {
|
|
||||||
fprintf(stderr, _("failed to rename %s to %s: %s\n"),
|
|
||||||
outputFileName, fileName, strerror(errno));
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
diff -ruN kudzu-0.99.50.old/updfstab.conf.default kudzu-0.99.50/updfstab.conf.default
|
|
||||||
--- kudzu-0.99.50.old/updfstab.conf.default 2002-01-16 04:32:17.000000000 +0100
|
|
||||||
+++ kudzu-0.99.50/updfstab.conf.default 2004-01-04 13:04:18.000000000 +0100
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-symlink false
|
|
||||||
+symlink true
|
|
||||||
partition 0
|
|
||||||
|
|
||||||
device cdrom {
|
|
||||||
@@ -73,9 +73,11 @@
|
|
||||||
match hd ImageMate
|
|
||||||
}
|
|
||||||
|
|
||||||
-device floppy {
|
|
||||||
- match hd USB-FDU
|
|
||||||
- match floppy "floppy drive"
|
|
||||||
+device floppy {
|
|
||||||
+ match hd USB-FDU
|
|
||||||
+ match floppy USB-FDU
|
|
||||||
+ match floppy FD
|
|
||||||
+ match floppy "floppy drive"
|
|
||||||
}
|
|
||||||
|
|
||||||
device diskonkey {
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
diff -ruN kudzu-1.1.68.2.orig/Makefile kudzu-1.1.68.2/Makefile
|
|
||||||
--- kudzu-1.1.68.2.orig/Makefile 2004-09-01 01:11:42.000000000 +0000
|
|
||||||
+++ kudzu-1.1.68.2/Makefile 2005-04-29 22:43:00.000000000 +0000
|
|
||||||
@@ -52,7 +52,7 @@
|
|
||||||
LOADEROBJ += s390.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
-DIET = diet
|
|
||||||
+DIET =
|
|
||||||
ifeq (i386,$(ARCH))
|
|
||||||
LOADEROBJS = $(patsubst %.o,%.do,$(LOADEROBJ))
|
|
||||||
else
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
backport from current 1.4 beta's to handle the bug where the
|
|
||||||
PNG_NO_ASSEMBLER_CODE define is not exported properly
|
|
||||||
|
|
||||||
http://bugs.gentoo.org/136346
|
|
||||||
|
|
||||||
--- libpng-1.2.12/configure.ac
|
|
||||||
+++ libpng-1.2.12/configure.ac
|
|
||||||
@@ -62,15 +62,12 @@
|
|
||||||
AC_TRY_COMPILE(
|
|
||||||
[#include "pnggccrd.c"],
|
|
||||||
[return 0;],
|
|
||||||
- LIBPNG_DEFINES=,
|
|
||||||
- LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG\ -DPNG_NO_ASSEMBLER_CODE)
|
|
||||||
-if test "$LIBPNG_DEFINES"; then
|
|
||||||
- AC_MSG_RESULT(no)
|
|
||||||
-else
|
|
||||||
- AC_MSG_RESULT(yes)
|
|
||||||
- LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
|
|
||||||
-fi
|
|
||||||
+ [LIBPNG_NO_ASSEMBLER=yes; LIBPNG_DEFINES=""],
|
|
||||||
+ [LIBPNG_NO_ASSEMBLER=no ; LIBPNG_DEFINES="-DPNG_NO_ASSEMBLER_CODE=1"])
|
|
||||||
+LIBPNG_DEFINES="$LIBPNG_DEFINES -DPNG_CONFIGURE_LIBPNG"
|
|
||||||
+AC_MSG_RESULT($LIBPNG_NO_ASSEMBLER)
|
|
||||||
AC_SUBST(LIBPNG_DEFINES)
|
|
||||||
+AM_CONDITIONAL(LIBPNG_NO_ASSEMBLER, test "x$LIBPNG_NO_ASSEMBLER" = "xno")
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if libraries can be versioned])
|
|
||||||
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
|
||||||
--- libpng-1.2.12/Makefile.am
|
|
||||||
+++ libpng-1.2.12/Makefile.am
|
|
||||||
@@ -87,6 +87,14 @@
|
|
||||||
|
|
||||||
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers libpng.sym
|
|
||||||
|
|
||||||
+pngconf.h: pngconf.h.in
|
|
||||||
+ sed "/Makefile-supplied defines go here:/q" pngconf.h.in > pngconf.h.tmp
|
|
||||||
+if LIBPNG_NO_ASSEMBLER
|
|
||||||
+ echo "#define PNG_NO_ASSEMBLER_CODE 1" >> pngconf.h.tmp
|
|
||||||
+endif
|
|
||||||
+ sed "1,/Makefile-supplied defines go here:/d" pngconf.h.in >> pngconf.h.tmp
|
|
||||||
+ mv pngconf.h.tmp pngconf.h
|
|
||||||
+
|
|
||||||
$(PNGLIB_BASENAME).pc: libpng.pc
|
|
||||||
cp libpng.pc $@
|
|
||||||
|
|
||||||
--- libpng-1.2.12/pngconf.h
|
|
||||||
+++ libpng-1.2.12/pngconf.h
|
|
||||||
@@ -19,6 +19,13 @@
|
|
||||||
|
|
||||||
#define PNG_1_2_X
|
|
||||||
|
|
||||||
+/* Backported no-assembler fix from libpng-1.4.0beta8 */
|
|
||||||
+
|
|
||||||
+/* Makefile-supplied defines go here: */
|
|
||||||
+/* End of Makefile-supplied defines. */
|
|
||||||
+
|
|
||||||
+/* End of backported no-assembler fix */
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* PNG_USER_CONFIG has to be defined on the compiler command line. This
|
|
||||||
* includes the resource compiler for Windows DLL configurations.
|
|
||||||
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
*** old/pci_ids.h Mon Aug 25 13:44:44 2003
|
|
||||||
--- include/linux/pci_ids.h Fri Oct 10 17:55:38 2003
|
|
||||||
***************
|
|
||||||
*** 862,865 ****
|
|
||||||
--- 862,866 ----
|
|
||||||
#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151
|
|
||||||
#define PCI_DEVICE_ID_PLX_R753 0x1152
|
|
||||||
+ #define PCI_DEVICE_ID_PLX_R753_2 0x1187
|
|
||||||
#define PCI_DEVICE_ID_PLX_9050 0x9050
|
|
||||||
#define PCI_DEVICE_ID_PLX_9060 0x9060
|
|
||||||
*** old/config.c Mon Aug 25 13:44:42 2003
|
|
||||||
--- drivers/isdn/hisax/config.c Fri Oct 10 17:56:02 2003
|
|
||||||
***************
|
|
||||||
*** 2130,2133 ****
|
|
||||||
--- 2130,2134 ----
|
|
||||||
{PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753, PCI_ANY_ID, PCI_ANY_ID},
|
|
||||||
{PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO, PCI_ANY_ID, PCI_ANY_ID},
|
|
||||||
+ {PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_R753_2, PCI_ANY_ID, PCI_ANY_ID},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_HISAX_QUADRO
|
|
||||||
*** old/gazel.c Fri Dec 21 18:41:54 2001
|
|
||||||
--- drivers/isdn/hisax/gazel.c Fri Oct 10 18:04:52 2003
|
|
||||||
***************
|
|
||||||
*** 559,563 ****
|
|
||||||
}
|
|
||||||
seekcard = PCI_DEVICE_ID_PLX_R685;
|
|
||||||
! for (nbseek = 0; nbseek < 3; nbseek++) {
|
|
||||||
if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX, seekcard, dev_tel))) {
|
|
||||||
if (pci_enable_device(dev_tel))
|
|
||||||
--- 559,563 ----
|
|
||||||
}
|
|
||||||
seekcard = PCI_DEVICE_ID_PLX_R685;
|
|
||||||
! for (nbseek = 0; nbseek < 4; nbseek++) {
|
|
||||||
if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX, seekcard, dev_tel))) {
|
|
||||||
if (pci_enable_device(dev_tel))
|
|
||||||
***************
|
|
||||||
*** 578,581 ****
|
|
||||||
--- 578,584 ----
|
|
||||||
seekcard = PCI_DEVICE_ID_PLX_DJINN_ITOO;
|
|
||||||
break;
|
|
||||||
+ case PCI_DEVICE_ID_PLX_DJINN_ITOO:
|
|
||||||
+ seekcard = PCI_DEVICE_ID_PLX_R753_2;
|
|
||||||
+ break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
***************
|
|
||||||
*** 621,624 ****
|
|
||||||
--- 624,635 ----
|
|
||||||
cs->subtyp = R753;
|
|
||||||
test_and_set_bit(HW_IPAC, &cs->HW_Flags);
|
|
||||||
+ printk(KERN_INFO
|
|
||||||
+ "Gazel: config irq:%d ipac:0x%X cfg:0x%X\n",
|
|
||||||
+ cs->irq, cs->hw.gazel.ipac, cs->hw.gazel.cfg_reg);
|
|
||||||
+ break;
|
|
||||||
+ case PCI_DEVICE_ID_PLX_R753_2:
|
|
||||||
+ printk(KERN_INFO "Gazel: Card PCI R753 0x1187 found\n");
|
|
||||||
+ cs->subtyp = R753;
|
|
||||||
+ test_and_set_bit(HW_IPAC, &cs->HW_Flags);
|
|
||||||
printk(KERN_INFO
|
|
||||||
"Gazel: config irq:%d ipac:0x%X cfg:0x%X\n",
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
diff -ur g/linux-2.4.26/drivers/block/ll_rw_blk.c h/linux-2.4.26/drivers/block/ll_rw_blk.c
|
|
||||||
--- g/linux-2.4.26/drivers/block/ll_rw_blk.c 2004-04-14 14:05:29.000000000 +0100
|
|
||||||
+++ h/linux-2.4.26/drivers/block/ll_rw_blk.c 2004-06-07 19:36:15.000000000 +0100
|
|
||||||
@@ -696,20 +696,26 @@
|
|
||||||
{
|
|
||||||
unsigned int major = MAJOR(dev);
|
|
||||||
unsigned int index;
|
|
||||||
+ dk_stat_t * ds;
|
|
||||||
|
|
||||||
+ ds = kstat.dk_drive_info[major];
|
|
||||||
+ if (ds == NULL)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
index = disk_index(dev);
|
|
||||||
- if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
|
|
||||||
+ if (index >= DK_MAX_DISK)
|
|
||||||
return;
|
|
||||||
-
|
|
||||||
- kstat.dk_drive[major][index] += new_io;
|
|
||||||
+
|
|
||||||
+ ds += index;
|
|
||||||
if (rw == READ) {
|
|
||||||
- kstat.dk_drive_rio[major][index] += new_io;
|
|
||||||
- kstat.dk_drive_rblk[major][index] += nr_sectors;
|
|
||||||
+ ds->dk_drive_rio += new_io;
|
|
||||||
+ ds->dk_drive_rblk += nr_sectors;
|
|
||||||
} else if (rw == WRITE) {
|
|
||||||
- kstat.dk_drive_wio[major][index] += new_io;
|
|
||||||
- kstat.dk_drive_wblk[major][index] += nr_sectors;
|
|
||||||
- } else
|
|
||||||
+ ds->dk_drive_wio += new_io;
|
|
||||||
+ ds->dk_drive_wblk += nr_sectors;
|
|
||||||
+ } else {
|
|
||||||
printk(KERN_ERR "drive_stat_acct: cmd not R/W?\n");
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_STATS
|
|
||||||
diff -ur g/linux-2.4.26/drivers/md/md.c h/linux-2.4.26/drivers/md/md.c
|
|
||||||
--- g/linux-2.4.26/drivers/md/md.c 2003-08-25 12:44:42.000000000 +0100
|
|
||||||
+++ h/linux-2.4.26/drivers/md/md.c 2004-06-07 19:36:15.000000000 +0100
|
|
||||||
@@ -3381,12 +3381,15 @@
|
|
||||||
ITERATE_RDEV(mddev,rdev,tmp) {
|
|
||||||
int major = MAJOR(rdev->dev);
|
|
||||||
int idx = disk_index(rdev->dev);
|
|
||||||
+ dk_stat_t * ds;
|
|
||||||
|
|
||||||
if ((idx >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- curr_events = kstat.dk_drive_rblk[major][idx] +
|
|
||||||
- kstat.dk_drive_wblk[major][idx] ;
|
|
||||||
+ if ((ds = kstat.dk_drive_info[major]) == NULL)
|
|
||||||
+ continue;
|
|
||||||
+ ds += idx;
|
|
||||||
+ curr_events = ds->dk_drive_rblk + ds->dk_drive_wblk;
|
|
||||||
curr_events -= sync_io[major][idx];
|
|
||||||
if ((curr_events - rdev->last_events) > 32) {
|
|
||||||
rdev->last_events = curr_events;
|
|
||||||
diff -ur g/linux-2.4.26/fs/block_dev.c h/linux-2.4.26/fs/block_dev.c
|
|
||||||
--- g/linux-2.4.26/fs/block_dev.c 2003-06-13 15:51:37.000000000 +0100
|
|
||||||
+++ h/linux-2.4.26/fs/block_dev.c 2004-06-07 19:36:15.000000000 +0100
|
|
||||||
@@ -13,6 +13,7 @@
|
|
||||||
#include <linux/slab.h>
|
|
||||||
#include <linux/kmod.h>
|
|
||||||
#include <linux/major.h>
|
|
||||||
+#include <linux/kernel_stat.h>
|
|
||||||
#include <linux/devfs_fs_kernel.h>
|
|
||||||
#include <linux/smp_lock.h>
|
|
||||||
#include <linux/iobuf.h>
|
|
||||||
@@ -465,11 +466,52 @@
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Allocate a statistics structure for the give device
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+static int alloc_dk_stat(unsigned int major)
|
|
||||||
+{
|
|
||||||
+ dk_stat_t * new;
|
|
||||||
+
|
|
||||||
+ /*allocate space for statistics */
|
|
||||||
+ if (kstat.dk_drive_info[major] != NULL) {
|
|
||||||
+ printk(KERN_WARNING "register_blkdev: stat struct"
|
|
||||||
+ " for device %d exists before register\n",
|
|
||||||
+ major);
|
|
||||||
+ } else {
|
|
||||||
+ int size = sizeof(dk_stat_t) * DK_MAX_DISK;
|
|
||||||
+ new = (dk_stat_t *)kmalloc(size, GFP_KERNEL);
|
|
||||||
+ if (new == NULL) {
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+ }
|
|
||||||
+ memset(new, 0, size);
|
|
||||||
+ kstat.dk_drive_info[major] = new;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void free_dk_stat(unsigned int major)
|
|
||||||
+{
|
|
||||||
+ dk_stat_t * ds;
|
|
||||||
+
|
|
||||||
+ ds = kstat.dk_drive_info[major];
|
|
||||||
+ kstat.dk_drive_info[major] = NULL;
|
|
||||||
+
|
|
||||||
+ if (ds != NULL)
|
|
||||||
+ kfree(ds);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int register_blkdev(unsigned int major, const char * name, struct block_device_operations *bdops)
|
|
||||||
{
|
|
||||||
+ int err;
|
|
||||||
+
|
|
||||||
if (major == 0) {
|
|
||||||
for (major = MAX_BLKDEV-1; major > 0; major--) {
|
|
||||||
if (blkdevs[major].bdops == NULL) {
|
|
||||||
+ err = alloc_dk_stat(major);
|
|
||||||
+ if (err != 0)
|
|
||||||
+ return err;
|
|
||||||
blkdevs[major].name = name;
|
|
||||||
blkdevs[major].bdops = bdops;
|
|
||||||
return major;
|
|
||||||
@@ -481,8 +523,13 @@
|
|
||||||
return -EINVAL;
|
|
||||||
if (blkdevs[major].bdops && blkdevs[major].bdops != bdops)
|
|
||||||
return -EBUSY;
|
|
||||||
+
|
|
||||||
+ err = alloc_dk_stat(major);
|
|
||||||
+ if (err != 0)
|
|
||||||
+ return err;
|
|
||||||
blkdevs[major].name = name;
|
|
||||||
blkdevs[major].bdops = bdops;
|
|
||||||
+
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -496,6 +543,9 @@
|
|
||||||
return -EINVAL;
|
|
||||||
blkdevs[major].name = NULL;
|
|
||||||
blkdevs[major].bdops = NULL;
|
|
||||||
+
|
|
||||||
+ /* free statistic structure */
|
|
||||||
+ free_dk_stat(major);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -ur g/linux-2.4.26/fs/proc/proc_misc.c h/linux-2.4.26/fs/proc/proc_misc.c
|
|
||||||
--- g/linux-2.4.26/fs/proc/proc_misc.c 2003-11-28 18:26:21.000000000 +0000
|
|
||||||
+++ h/linux-2.4.26/fs/proc/proc_misc.c 2004-06-07 19:37:08.000000000 +0100
|
|
||||||
@@ -355,23 +355,28 @@
|
|
||||||
|
|
||||||
proc_sprintf(page, &off, &len, "\ndisk_io: ");
|
|
||||||
|
|
||||||
- for (major = 0; major < DK_MAX_MAJOR; major++) {
|
|
||||||
- for (disk = 0; disk < DK_MAX_DISK; disk++) {
|
|
||||||
- int active = kstat.dk_drive[major][disk] +
|
|
||||||
- kstat.dk_drive_rblk[major][disk] +
|
|
||||||
- kstat.dk_drive_wblk[major][disk];
|
|
||||||
+ for (major = 0; major < MAX_BLKDEV; major++) {
|
|
||||||
+ if ( kstat.dk_drive_info[major] == NULL)
|
|
||||||
+ continue;
|
|
||||||
+ for (disk = 0; disk < DK_MAX_DISK; disk++) {
|
|
||||||
+ dk_stat_t * ds;
|
|
||||||
+ int active;
|
|
||||||
+
|
|
||||||
+ ds = kstat.dk_drive_info[major] + disk;
|
|
||||||
+ active = ds->dk_drive_rio + ds->dk_drive_wio +
|
|
||||||
+ ds->dk_drive_rblk + ds->dk_drive_wblk;
|
|
||||||
if (active)
|
|
||||||
proc_sprintf(page, &off, &len,
|
|
||||||
"(%u,%u):(%u,%u,%u,%u,%u) ",
|
|
||||||
- major, disk,
|
|
||||||
- kstat.dk_drive[major][disk],
|
|
||||||
- kstat.dk_drive_rio[major][disk],
|
|
||||||
- kstat.dk_drive_rblk[major][disk],
|
|
||||||
- kstat.dk_drive_wio[major][disk],
|
|
||||||
- kstat.dk_drive_wblk[major][disk]
|
|
||||||
- );
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ major, disk,
|
|
||||||
+ ds->dk_drive_rio + ds->dk_drive_wio,
|
|
||||||
+ ds->dk_drive_rio,
|
|
||||||
+ ds->dk_drive_rblk,
|
|
||||||
+ ds->dk_drive_wio,
|
|
||||||
+ ds->dk_drive_wblk
|
|
||||||
+ );
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
proc_sprintf(page, &off, &len,
|
|
||||||
"\nctxt %u\n"
|
|
||||||
diff -ur g/linux-2.4.26/include/linux/genhd.h h/linux-2.4.26/include/linux/genhd.h
|
|
||||||
--- g/linux-2.4.26/include/linux/genhd.h 2002-11-28 23:53:15.000000000 +0000
|
|
||||||
+++ h/linux-2.4.26/include/linux/genhd.h 2004-06-07 19:36:15.000000000 +0100
|
|
||||||
@@ -294,21 +294,30 @@
|
|
||||||
unsigned int index;
|
|
||||||
|
|
||||||
switch (major) {
|
|
||||||
- case DAC960_MAJOR+0:
|
|
||||||
- index = (minor & 0x00f8) >> 3;
|
|
||||||
- break;
|
|
||||||
case SCSI_DISK0_MAJOR:
|
|
||||||
index = (minor & 0x00f0) >> 4;
|
|
||||||
break;
|
|
||||||
case IDE0_MAJOR: /* same as HD_MAJOR */
|
|
||||||
case XT_DISK_MAJOR:
|
|
||||||
+ case IDE1_MAJOR:
|
|
||||||
+ case IDE2_MAJOR:
|
|
||||||
+ case IDE3_MAJOR:
|
|
||||||
+ case IDE4_MAJOR:
|
|
||||||
+ case IDE5_MAJOR:
|
|
||||||
index = (minor & 0x0040) >> 6;
|
|
||||||
break;
|
|
||||||
- case IDE1_MAJOR:
|
|
||||||
- index = ((minor & 0x0040) >> 6) + 2;
|
|
||||||
+ case SCSI_CDROM_MAJOR:
|
|
||||||
+ index = minor & 0x000f;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
- return 0;
|
|
||||||
+ if (major >= SCSI_DISK1_MAJOR && major <= SCSI_DISK7_MAJOR)
|
|
||||||
+ index = (minor & 0x00f0) >> 4;
|
|
||||||
+ else if (major >= DAC960_MAJOR && major <= DAC960_MAJOR + 7)
|
|
||||||
+ index = (minor & 0x00f8) >> 3;
|
|
||||||
+ else if (major >= IDE6_MAJOR && major <= IDE9_MAJOR)
|
|
||||||
+ index = (minor & 0x0040) >> 6;
|
|
||||||
+ else
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
diff -ur g/linux-2.4.26/include/linux/kernel_stat.h h/linux-2.4.26/include/linux/kernel_stat.h
|
|
||||||
--- g/linux-2.4.26/include/linux/kernel_stat.h 2003-06-13 15:51:38.000000000 +0100
|
|
||||||
+++ h/linux-2.4.26/include/linux/kernel_stat.h 2004-06-07 19:36:15.000000000 +0100
|
|
||||||
@@ -5,6 +5,7 @@
|
|
||||||
#include <asm/irq.h>
|
|
||||||
#include <linux/smp.h>
|
|
||||||
#include <linux/threads.h>
|
|
||||||
+#include <linux/major.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 'kernel_stat.h' contains the definitions needed for doing
|
|
||||||
@@ -15,15 +15,19 @@
|
|
||||||
#define DK_MAX_MAJOR 16
|
|
||||||
#define DK_MAX_DISK 16
|
|
||||||
|
|
||||||
+struct dk_stat{
|
|
||||||
+ unsigned int dk_drive_rio;
|
|
||||||
+ unsigned int dk_drive_wio;
|
|
||||||
+ unsigned int dk_drive_rblk;
|
|
||||||
+ unsigned int dk_drive_wblk;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+typedef struct dk_stat dk_stat_t;
|
|
||||||
struct kernel_stat {
|
|
||||||
unsigned int per_cpu_user[NR_CPUS],
|
|
||||||
per_cpu_nice[NR_CPUS],
|
|
||||||
per_cpu_system[NR_CPUS];
|
|
||||||
- unsigned int dk_drive[DK_MAX_MAJOR][DK_MAX_DISK];
|
|
||||||
- unsigned int dk_drive_rio[DK_MAX_MAJOR][DK_MAX_DISK];
|
|
||||||
- unsigned int dk_drive_wio[DK_MAX_MAJOR][DK_MAX_DISK];
|
|
||||||
- unsigned int dk_drive_rblk[DK_MAX_MAJOR][DK_MAX_DISK];
|
|
||||||
- unsigned int dk_drive_wblk[DK_MAX_MAJOR][DK_MAX_DISK];
|
|
||||||
+ dk_stat_t *dk_drive_info[MAX_BLKDEV];
|
|
||||||
unsigned int pgpgin, pgpgout;
|
|
||||||
unsigned int pswpin, pswpout;
|
|
||||||
#if defined (__hppa__)
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
--- drivers/scsi/libata-core.c.old 2004-07-01 15:21:15.000000000 +0100
|
|
||||||
+++ drivers/scsi/libata-core.c 2004-07-01 15:22:06.000000000 +0100
|
|
||||||
@@ -28,6 +28,7 @@
|
|
||||||
#include <linux/pci.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/list.h>
|
|
||||||
+#include <linux/mm.h>
|
|
||||||
#include <linux/highmem.h>
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
#include <linux/blkdev.h>
|
|
||||||
@@ -1,551 +0,0 @@
|
|||||||
Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
|
|
||||||
Date: 2004-11-03
|
|
||||||
Initial Package Version: Linux 2.4.27
|
|
||||||
Upstream Status: Rejected Upstream
|
|
||||||
Origin: http://frandom.sourceforge.net/ - frandom-0.8
|
|
||||||
Description: This is usefull for smashing stack protector, wiping
|
|
||||||
discs, mktemp, arc4random, and more.
|
|
||||||
This source was modified for 2.4.26, and is enabled by default in
|
|
||||||
arch/i386/defconfig. A define was added to sysctl.h too.
|
|
||||||
|
|
||||||
To get character devices do this:
|
|
||||||
mknod /dev/frandom c 235 11
|
|
||||||
mknod /dev/erandom c 235 12
|
|
||||||
|
|
||||||
Thanks to Eli Billauer
|
|
||||||
http://www.billauer.co.il/
|
|
||||||
http://frandom.sourceforge.net/
|
|
||||||
|
|
||||||
Also see:
|
|
||||||
http://www.linuxfromscratch.org/hlfs/
|
|
||||||
http://www.linuxfromscratch.org/hints/downloads/files/entropy.txt
|
|
||||||
http://www.linuxfromscratch.org/~robert/hlfs/hints/attachments/entropy/\
|
|
||||||
frandom-0.8.tar.gz
|
|
||||||
|
|
||||||
diff -Naur linux-2.4.27.orig/Documentation/Configure.help linux-2.4.27.frandom/Documentation/Configure.help
|
|
||||||
--- linux-2.4.27.orig/Documentation/Configure.help 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/Documentation/Configure.help 2004-11-04 01:11:24.126837840 +0000
|
|
||||||
@@ -18447,6 +18447,17 @@
|
|
||||||
input/output character sets. Say Y here for the UTF-8 encoding of
|
|
||||||
the Unicode/ISO9646 universal character set.
|
|
||||||
|
|
||||||
+Fast random data generator suite (/dev/frandom and /dev/erandom)
|
|
||||||
+CONFIG_FRANDOM
|
|
||||||
+ Fast random data/number generator support in kernel. This random
|
|
||||||
+ generator is 10-50 times faster than /dev/urandom, and saves kernel
|
|
||||||
+ entropy.
|
|
||||||
+
|
|
||||||
+ If unsure, say Y unless you're tight on kernel size. This module is
|
|
||||||
+ small and harmless otherwise.
|
|
||||||
+
|
|
||||||
+ If you choose M, the sysctl interface will be disabled.
|
|
||||||
+
|
|
||||||
Virtual terminal
|
|
||||||
CONFIG_VT
|
|
||||||
If you say Y here, you will get support for terminal devices with
|
|
||||||
diff -Naur linux-2.4.27.orig/arch/i386/defconfig linux-2.4.27.frandom/arch/i386/defconfig
|
|
||||||
--- linux-2.4.27.orig/arch/i386/defconfig 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/arch/i386/defconfig 2004-11-04 01:11:24.150834192 +0000
|
|
||||||
@@ -579,6 +579,7 @@
|
|
||||||
#
|
|
||||||
CONFIG_VT=y
|
|
||||||
CONFIG_VT_CONSOLE=y
|
|
||||||
+CONFIG_FRANDOM=y
|
|
||||||
CONFIG_SERIAL=y
|
|
||||||
# CONFIG_SERIAL_CONSOLE is not set
|
|
||||||
# CONFIG_SERIAL_EXTENDED is not set
|
|
||||||
diff -Naur linux-2.4.27.orig/drivers/char/Config.in linux-2.4.27.frandom/drivers/char/Config.in
|
|
||||||
--- linux-2.4.27.orig/drivers/char/Config.in 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/drivers/char/Config.in 2004-11-04 01:11:24.201826440 +0000
|
|
||||||
@@ -25,6 +25,7 @@
|
|
||||||
tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
+tristate 'Fast random data generator suite (/dev/frandom and /dev/erandom)' CONFIG_FRANDOM
|
|
||||||
dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL
|
|
||||||
if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then
|
|
||||||
bool ' Support more than 4 serial ports' CONFIG_SERIAL_MANY_PORTS
|
|
||||||
diff -Naur linux-2.4.27.orig/drivers/char/Makefile linux-2.4.27.frandom/drivers/char/Makefile
|
|
||||||
--- linux-2.4.27.orig/drivers/char/Makefile 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/drivers/char/Makefile 2004-11-04 01:11:24.209825224 +0000
|
|
||||||
@@ -25,7 +25,7 @@
|
|
||||||
misc.o pty.o random.o selection.o serial.o \
|
|
||||||
sonypi.o tty_io.o tty_ioctl.o generic_serial.o \
|
|
||||||
au1000_gpio.o vac-serial.o hp_psaux.o nvram.o \
|
|
||||||
- scx200.o fetchop.o
|
|
||||||
+ scx200.o fetchop.o frandom.o
|
|
||||||
|
|
||||||
mod-subdirs := joystick ftape drm drm-4.0 pcmcia
|
|
||||||
|
|
||||||
@@ -334,6 +334,8 @@
|
|
||||||
obj-y += ipmi/ipmi.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
+obj-$(CONFIG_FRANDOM) += frandom.o
|
|
||||||
+
|
|
||||||
include $(TOPDIR)/Rules.make
|
|
||||||
|
|
||||||
fastdep:
|
|
||||||
diff -Naur linux-2.4.27.orig/drivers/char/frandom.c linux-2.4.27.frandom/drivers/char/frandom.c
|
|
||||||
--- linux-2.4.27.orig/drivers/char/frandom.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/drivers/char/frandom.c 2004-11-04 01:11:24.213824616 +0000
|
|
||||||
@@ -0,0 +1,362 @@
|
|
||||||
+/*
|
|
||||||
+** frandom.c
|
|
||||||
+** Fast pseudo-random generator
|
|
||||||
+**
|
|
||||||
+** (c) Copyright 2003 Eli Billauer
|
|
||||||
+** http://www.billauer.co.il
|
|
||||||
+**
|
|
||||||
+** This program is free software; you can redistribute it and/or modify
|
|
||||||
+** it under the terms of the GNU General Public License as published by
|
|
||||||
+** the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+** (at your option) any later version.
|
|
||||||
+**
|
|
||||||
+** Usage: mknod /dev/frandom c 235 11
|
|
||||||
+** mknod /dev/erandom c 235 12
|
|
||||||
+** insmod frandom
|
|
||||||
+**
|
|
||||||
+** This code is highly based upon the examples given in the book "Linux
|
|
||||||
+** Device Drivers" by Alessandro Rubini and Jonathan Corbet, published
|
|
||||||
+** by O'Reilly & Associates.
|
|
||||||
+** O'Reilly's release of this book on the web for free is highly
|
|
||||||
+** appreciated.
|
|
||||||
+**
|
|
||||||
+*/
|
|
||||||
+
|
|
||||||
+#include <linux/version.h>
|
|
||||||
+#include <linux/config.h>
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+
|
|
||||||
+#include <linux/kernel.h>
|
|
||||||
+#include <linux/init.h>
|
|
||||||
+#include <linux/slab.h>
|
|
||||||
+#include <linux/fs.h>
|
|
||||||
+#include <linux/errno.h>
|
|
||||||
+#include <linux/types.h>
|
|
||||||
+#include <linux/random.h>
|
|
||||||
+
|
|
||||||
+#include <asm/uaccess.h>
|
|
||||||
+
|
|
||||||
+#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,0))
|
|
||||||
+#include <linux/moduleparam.h>
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#define INTERNAL_SEED 0
|
|
||||||
+#define EXTERNAL_SEED 1
|
|
||||||
+
|
|
||||||
+#define FRANDOM_MAJOR 235
|
|
||||||
+#define FRANDOM_MINOR 11
|
|
||||||
+#define ERANDOM_MINOR 12
|
|
||||||
+
|
|
||||||
+static struct file_operations frandom_fops; /* Values assigned below */
|
|
||||||
+
|
|
||||||
+static int erandom_seeded = 0; /* Internal flag */
|
|
||||||
+
|
|
||||||
+static int frandom_major = FRANDOM_MAJOR;
|
|
||||||
+static int frandom_minor = FRANDOM_MINOR;
|
|
||||||
+static int erandom_minor = ERANDOM_MINOR;
|
|
||||||
+static int frandom_bufsize = 256;
|
|
||||||
+static int frandom_chunklimit = 0; /* =0 means unlimited */
|
|
||||||
+
|
|
||||||
+MODULE_DESCRIPTION("Fast pseudo-random number generator");
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
+MODULE_AUTHOR("Eli Billauer");
|
|
||||||
+MODULE_PARM(frandom_major,"i");
|
|
||||||
+MODULE_PARM_DESC(frandom_major,"Major number of /dev/frandom and /dev/erandom");
|
|
||||||
+MODULE_PARM(frandom_minor,"i");
|
|
||||||
+MODULE_PARM_DESC(frandom_minor,"Minor number of /dev/frandom");
|
|
||||||
+MODULE_PARM(erandom_minor,"i");
|
|
||||||
+MODULE_PARM_DESC(erandom_minor,"Minor number of /dev/erandom");
|
|
||||||
+MODULE_PARM(frandom_bufsize,"i");
|
|
||||||
+MODULE_PARM_DESC(frandom_bufsize,"Internal buffer size in bytes. Default is 256. Must be >= 256");
|
|
||||||
+MODULE_PARM(frandom_chunklimit,"i");
|
|
||||||
+MODULE_PARM_DESC(frandom_chunklimit,"Limit for read() blocks size. 0 (default) is unlimited, otherwise must be >= 256");
|
|
||||||
+
|
|
||||||
+struct frandom_state
|
|
||||||
+{
|
|
||||||
+ struct semaphore sem; /* Semaphore on the state structure */
|
|
||||||
+
|
|
||||||
+ u8 S[256]; /* The state array */
|
|
||||||
+ u8 i;
|
|
||||||
+ u8 j;
|
|
||||||
+
|
|
||||||
+ char *buf;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static struct frandom_state *erandom_state;
|
|
||||||
+
|
|
||||||
+static inline void swap_byte(u8 *a, u8 *b)
|
|
||||||
+{
|
|
||||||
+ u8 swapByte;
|
|
||||||
+
|
|
||||||
+ swapByte = *a;
|
|
||||||
+ *a = *b;
|
|
||||||
+ *b = swapByte;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void init_rand_state(struct frandom_state *state, int seedflag);
|
|
||||||
+
|
|
||||||
+void erandom_get_random_bytes(char *buf, size_t count)
|
|
||||||
+{
|
|
||||||
+ struct frandom_state *state = erandom_state;
|
|
||||||
+ int k;
|
|
||||||
+
|
|
||||||
+ unsigned int i;
|
|
||||||
+ unsigned int j;
|
|
||||||
+ u8 *S;
|
|
||||||
+
|
|
||||||
+ /* If we fail to get the semaphore, we revert to external random data.
|
|
||||||
+ Since semaphore blocking is expected to be very rare, and interrupts
|
|
||||||
+ during these rare and very short periods of time even less frequent,
|
|
||||||
+ we take the better-safe-than-sorry approach, and fill the buffer
|
|
||||||
+ some expensive random data, in case the caller wasn't aware of this
|
|
||||||
+ possibility, and expects random data anyhow.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if (down_interruptible(&state->sem)) {
|
|
||||||
+ get_random_bytes(buf, count);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* We seed erandom as late as possible, hoping that the kernel's main
|
|
||||||
+ RNG is already restored in the boot sequence (not critical, but
|
|
||||||
+ better.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ if (!erandom_seeded) {
|
|
||||||
+ erandom_seeded = 1;
|
|
||||||
+ init_rand_state(state, EXTERNAL_SEED);
|
|
||||||
+ printk(KERN_INFO "frandom: Seeded global generator now (used by erandom)\n");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ i = state->i;
|
|
||||||
+ j = state->j;
|
|
||||||
+ S = state->S;
|
|
||||||
+
|
|
||||||
+ for (k=0; k<count; k++) {
|
|
||||||
+ i = (i + 1) & 0xff;
|
|
||||||
+ j = (j + S[i]) & 0xff;
|
|
||||||
+ swap_byte(&S[i], &S[j]);
|
|
||||||
+ *buf++ = S[(S[i] + S[j]) & 0xff];
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ state->i = i;
|
|
||||||
+ state->j = j;
|
|
||||||
+
|
|
||||||
+ up(&state->sem);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void init_rand_state(struct frandom_state *state, int seedflag)
|
|
||||||
+{
|
|
||||||
+ unsigned int i, j, k;
|
|
||||||
+ u8 *S;
|
|
||||||
+ u8 *seed = state->buf;
|
|
||||||
+
|
|
||||||
+ if (seedflag == INTERNAL_SEED)
|
|
||||||
+ erandom_get_random_bytes(seed, 256);
|
|
||||||
+ else
|
|
||||||
+ get_random_bytes(seed, 256);
|
|
||||||
+
|
|
||||||
+ S = state->S;
|
|
||||||
+ for (i=0; i<256; i++)
|
|
||||||
+ *S++=i;
|
|
||||||
+
|
|
||||||
+ j=0;
|
|
||||||
+ S = state->S;
|
|
||||||
+
|
|
||||||
+ for (i=0; i<256; i++) {
|
|
||||||
+ j = (j + S[i] + *seed++) & 0xff;
|
|
||||||
+ swap_byte(&S[i], &S[j]);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* It's considered good practice to discard the first 256 bytes
|
|
||||||
+ generated. So we do it:
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ i=0; j=0;
|
|
||||||
+ for (k=0; k<256; k++) {
|
|
||||||
+ i = (i + 1) & 0xff;
|
|
||||||
+ j = (j + S[i]) & 0xff;
|
|
||||||
+ swap_byte(&S[i], &S[j]);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ state->i = i; /* Save state */
|
|
||||||
+ state->j = j;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int frandom_open(struct inode *inode, struct file *filp)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ struct frandom_state *state;
|
|
||||||
+
|
|
||||||
+ int num =MINOR(inode->i_rdev);
|
|
||||||
+ if ((num != frandom_minor) && (num != erandom_minor)) return -ENODEV;
|
|
||||||
+
|
|
||||||
+ state = kmalloc(sizeof(struct frandom_state), GFP_KERNEL);
|
|
||||||
+ if (!state)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+
|
|
||||||
+ state->buf = kmalloc(frandom_bufsize, GFP_KERNEL);
|
|
||||||
+ if (!state->buf) {
|
|
||||||
+ kfree(state);
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ sema_init(&state->sem, 1); /* Init semaphore as a mutex */
|
|
||||||
+
|
|
||||||
+ if (num == frandom_minor)
|
|
||||||
+ init_rand_state(state, EXTERNAL_SEED);
|
|
||||||
+ else
|
|
||||||
+ init_rand_state(state, INTERNAL_SEED);
|
|
||||||
+
|
|
||||||
+ filp->private_data = state;
|
|
||||||
+
|
|
||||||
+#if (LINUX_VERSION_CODE<KERNEL_VERSION(2,4,0))
|
|
||||||
+ MOD_INC_USE_COUNT;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ return 0; /* Success */
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int frandom_release(struct inode *inode, struct file *filp)
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+ struct frandom_state *state = filp->private_data;
|
|
||||||
+
|
|
||||||
+ kfree(state->buf);
|
|
||||||
+ kfree(state);
|
|
||||||
+
|
|
||||||
+#if (LINUX_VERSION_CODE<KERNEL_VERSION(2,4,0))
|
|
||||||
+ MOD_DEC_USE_COUNT;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static ssize_t frandom_read(struct file *filp, char *buf, size_t count,
|
|
||||||
+ loff_t *f_pos)
|
|
||||||
+{
|
|
||||||
+ struct frandom_state *state = filp->private_data;
|
|
||||||
+ ssize_t ret;
|
|
||||||
+ int dobytes, k;
|
|
||||||
+ char *localbuf;
|
|
||||||
+
|
|
||||||
+ unsigned int i;
|
|
||||||
+ unsigned int j;
|
|
||||||
+ u8 *S;
|
|
||||||
+
|
|
||||||
+ if (down_interruptible(&state->sem))
|
|
||||||
+ return -ERESTARTSYS;
|
|
||||||
+
|
|
||||||
+ if ((frandom_chunklimit > 0) && (count > frandom_chunklimit))
|
|
||||||
+ count = frandom_chunklimit;
|
|
||||||
+
|
|
||||||
+ ret = count; /* It's either everything or an error... */
|
|
||||||
+
|
|
||||||
+ i = state->i;
|
|
||||||
+ j = state->j;
|
|
||||||
+ S = state->S;
|
|
||||||
+
|
|
||||||
+ while (count) {
|
|
||||||
+ if (count > frandom_bufsize)
|
|
||||||
+ dobytes = frandom_bufsize;
|
|
||||||
+ else
|
|
||||||
+ dobytes = count;
|
|
||||||
+
|
|
||||||
+ localbuf = state->buf;
|
|
||||||
+
|
|
||||||
+ for (k=0; k<dobytes; k++) {
|
|
||||||
+ i = (i + 1) & 0xff;
|
|
||||||
+ j = (j + S[i]) & 0xff;
|
|
||||||
+ swap_byte(&S[i], &S[j]);
|
|
||||||
+ *localbuf++ = S[(S[i] + S[j]) & 0xff];
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (copy_to_user(buf, state->buf, dobytes)) {
|
|
||||||
+ ret = -EFAULT;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ buf += dobytes;
|
|
||||||
+ count -= dobytes;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ out:
|
|
||||||
+ state->i = i;
|
|
||||||
+ state->j = j;
|
|
||||||
+
|
|
||||||
+ up(&state->sem);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static struct file_operations frandom_fops = {
|
|
||||||
+ read: frandom_read,
|
|
||||||
+ open: frandom_open,
|
|
||||||
+ release: frandom_release,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static void frandom_cleanup_module(void) {
|
|
||||||
+ kfree(erandom_state->buf);
|
|
||||||
+ kfree(erandom_state);
|
|
||||||
+
|
|
||||||
+ unregister_chrdev(frandom_major, "frandom");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static int frandom_init_module(void)
|
|
||||||
+{
|
|
||||||
+ int result;
|
|
||||||
+
|
|
||||||
+ /* The buffer size MUST be at least 256 bytes, because we assume that
|
|
||||||
+ minimal length in init_rand_state().
|
|
||||||
+ */
|
|
||||||
+ if (frandom_bufsize < 256) {
|
|
||||||
+ printk(KERN_ERR "frandom: Refused to load because frandom_bufsize=%d < 256\n",frandom_bufsize);
|
|
||||||
+ return -EINVAL;
|
|
||||||
+ }
|
|
||||||
+ if ((frandom_chunklimit != 0) && (frandom_chunklimit < 256)) {
|
|
||||||
+ printk(KERN_ERR "frandom: Refused to load because frandom_chunklimit=%d < 256 and != 0\n",frandom_chunklimit);
|
|
||||||
+ return -EINVAL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ erandom_state = kmalloc(sizeof(struct frandom_state), GFP_KERNEL);
|
|
||||||
+ if (!erandom_state)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+
|
|
||||||
+ /* This specific buffer is only used for seeding, so we need
|
|
||||||
+ 256 bytes exactly */
|
|
||||||
+ erandom_state->buf = kmalloc(256, GFP_KERNEL);
|
|
||||||
+ if (!erandom_state->buf) {
|
|
||||||
+ kfree(erandom_state);
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ sema_init(&erandom_state->sem, 1); /* Init semaphore as a mutex */
|
|
||||||
+
|
|
||||||
+ erandom_seeded = 0;
|
|
||||||
+
|
|
||||||
+#ifdef SET_MODULE_OWNER
|
|
||||||
+ SET_MODULE_OWNER(&frandom_fops);
|
|
||||||
+#endif
|
|
||||||
+ /*
|
|
||||||
+ * Register your major, and accept a dynamic number. This is the
|
|
||||||
+ * first thing to do, in order to avoid releasing other module's
|
|
||||||
+ * fops in frandom_cleanup_module()
|
|
||||||
+ */
|
|
||||||
+ result = register_chrdev(frandom_major, "frandom", &frandom_fops);
|
|
||||||
+ if (result < 0) {
|
|
||||||
+ printk(KERN_WARNING "frandom: can't get major %d\n",frandom_major);
|
|
||||||
+
|
|
||||||
+ kfree(erandom_state->buf);
|
|
||||||
+ kfree(erandom_state);
|
|
||||||
+
|
|
||||||
+ return result;
|
|
||||||
+ }
|
|
||||||
+ if (frandom_major == 0) frandom_major = result; /* dynamic */
|
|
||||||
+
|
|
||||||
+ return 0; /* succeed */
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(frandom_init_module);
|
|
||||||
+module_exit(frandom_cleanup_module);
|
|
||||||
+
|
|
||||||
+EXPORT_SYMBOL(erandom_get_random_bytes);
|
|
||||||
diff -Naur linux-2.4.27.orig/drivers/char/random.c linux-2.4.27.frandom/drivers/char/random.c
|
|
||||||
--- linux-2.4.27.orig/drivers/char/random.c 2004-02-18 13:36:31.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/drivers/char/random.c 2004-11-04 01:11:24.260817472 +0000
|
|
||||||
@@ -1870,6 +1870,60 @@
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef CONFIG_FRANDOM
|
|
||||||
+/* We don't really want to create a header file for frandom
|
|
||||||
+ at this stage, so here's the prototype: */
|
|
||||||
+
|
|
||||||
+void erandom_get_random_bytes(char *buf, size_t count);
|
|
||||||
+
|
|
||||||
+static int proc_do_erandom(ctl_table *table, int write, struct file *filp,
|
|
||||||
+ void *buffer, size_t *lenp)
|
|
||||||
+{
|
|
||||||
+ ctl_table fake_table;
|
|
||||||
+ unsigned char buf[64], random[16], *p;
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ erandom_get_random_bytes(random, 16);
|
|
||||||
+
|
|
||||||
+ p=buf;
|
|
||||||
+
|
|
||||||
+ for (i=0; i<16; i++) {
|
|
||||||
+ sprintf(p, "%02x", random[i]);
|
|
||||||
+ p+=2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fake_table.data = buf;
|
|
||||||
+ fake_table.maxlen = sizeof(buf);
|
|
||||||
+
|
|
||||||
+ return proc_dostring(&fake_table, write, filp, buffer, lenp);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static int erandom_strategy(ctl_table *table, int *name, int nlen,
|
|
||||||
+ void *oldval, size_t *oldlenp,
|
|
||||||
+ void *newval, size_t newlen, void **context)
|
|
||||||
+{
|
|
||||||
+ unsigned char random[16];
|
|
||||||
+ unsigned int len;
|
|
||||||
+
|
|
||||||
+ if (!oldval || !oldlenp)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ erandom_get_random_bytes(random, 16);
|
|
||||||
+
|
|
||||||
+ if (get_user(len, oldlenp))
|
|
||||||
+ return -EFAULT;
|
|
||||||
+ if (len) {
|
|
||||||
+ if (len > 16)
|
|
||||||
+ len = 16;
|
|
||||||
+ if (copy_to_user(oldval, random, len) ||
|
|
||||||
+ put_user(len, oldlenp))
|
|
||||||
+ return -EFAULT;
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
ctl_table random_table[] = {
|
|
||||||
{RANDOM_POOLSIZE, "poolsize",
|
|
||||||
&sysctl_poolsize, sizeof(int), 0644, NULL,
|
|
||||||
@@ -1888,6 +1942,11 @@
|
|
||||||
{RANDOM_BOOT_ID, "boot_id",
|
|
||||||
&sysctl_bootid, 16, 0444, NULL,
|
|
||||||
&proc_do_uuid, &uuid_strategy},
|
|
||||||
+#ifdef CONFIG_FRANDOM
|
|
||||||
+ {RANDOM_ERANDOM, "erandom",
|
|
||||||
+ NULL, 16, 0444, NULL,
|
|
||||||
+ &proc_do_erandom, &erandom_strategy},
|
|
||||||
+#endif
|
|
||||||
{RANDOM_UUID, "uuid",
|
|
||||||
NULL, 16, 0444, NULL,
|
|
||||||
&proc_do_uuid, &uuid_strategy},
|
|
||||||
diff -Naur linux-2.4.27.orig/include/linux/sysctl.h linux-2.4.27.frandom/include/linux/sysctl.h
|
|
||||||
--- linux-2.4.27.orig/include/linux/sysctl.h 2004-08-07 23:26:06.000000000 +0000
|
|
||||||
+++ linux-2.4.27.frandom/include/linux/sysctl.h 2004-11-04 01:13:02.000000000 +0000
|
|
||||||
@@ -184,6 +184,7 @@
|
|
||||||
};
|
|
||||||
|
|
||||||
/* /proc/sys/kernel/random */
|
|
||||||
+#define SYSCTL_ERANDOM
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
RANDOM_POOLSIZE=1,
|
|
||||||
@@ -191,7 +192,8 @@
|
|
||||||
RANDOM_READ_THRESH=3,
|
|
||||||
RANDOM_WRITE_THRESH=4,
|
|
||||||
RANDOM_BOOT_ID=5,
|
|
||||||
- RANDOM_UUID=6
|
|
||||||
+ RANDOM_UUID=6,
|
|
||||||
+ RANDOM_ERANDOM=7
|
|
||||||
};
|
|
||||||
|
|
||||||
/* /proc/sys/bus/isa */
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
|
|
||||||
Date: 2004-08-30
|
|
||||||
Initial Package Version: 2.4.27
|
|
||||||
Upstream Status: Rejected Upstream
|
|
||||||
Origin: http://www.northernsecurity.net/adamantix/diffs/2.4.20-propolice.patch
|
|
||||||
Description: Linux kernel patch for Smashing Stack Protector. This patch allows
|
|
||||||
the use of -fstack-protector durring the kernel build.
|
|
||||||
http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
|
|
||||||
http://www.linuxfromscratch.org/hlfs/
|
|
||||||
|
|
||||||
diff -Naur linux-2.4.26.orig/include/linux/kernel.h linux-2.4.26.ssp/include/linux/kernel.h
|
|
||||||
--- linux-2.4.26.orig/include/linux/kernel.h 2002-11-28 23:53:15.000000000 +0000
|
|
||||||
+++ linux-2.4.26.ssp/include/linux/kernel.h 2004-04-18 19:54:08.000000000 +0000
|
|
||||||
@@ -86,6 +86,9 @@
|
|
||||||
extern void dev_probe_lock(void);
|
|
||||||
extern void dev_probe_unlock(void);
|
|
||||||
|
|
||||||
+extern int __guard;
|
|
||||||
+extern void __stack_smash_handler(int, char []);
|
|
||||||
+
|
|
||||||
extern int session_of_pgrp(int pgrp);
|
|
||||||
|
|
||||||
asmlinkage int printk(const char * fmt, ...)
|
|
||||||
diff -Naur linux-2.4.26.orig/kernel/ksyms.c linux-2.4.26.ssp/kernel/ksyms.c
|
|
||||||
--- linux-2.4.26.orig/kernel/ksyms.c 2004-02-18 13:36:32.000000000 +0000
|
|
||||||
+++ linux-2.4.26.ssp/kernel/ksyms.c 2004-04-18 19:54:08.000000000 +0000
|
|
||||||
@@ -528,6 +528,8 @@
|
|
||||||
EXPORT_SYMBOL(single_open);
|
|
||||||
EXPORT_SYMBOL(single_release);
|
|
||||||
EXPORT_SYMBOL(seq_release_private);
|
|
||||||
+EXPORT_SYMBOL_NOVERS(__guard);
|
|
||||||
+EXPORT_SYMBOL_NOVERS(__stack_smash_handler);
|
|
||||||
|
|
||||||
/* Program loader interfaces */
|
|
||||||
EXPORT_SYMBOL(setup_arg_pages);
|
|
||||||
diff -Naur linux-2.4.26.orig/lib/Makefile linux-2.4.26.ssp/lib/Makefile
|
|
||||||
--- linux-2.4.26.orig/lib/Makefile 2004-04-14 13:05:40.000000000 +0000
|
|
||||||
+++ linux-2.4.26.ssp/lib/Makefile 2004-04-18 19:54:08.000000000 +0000
|
|
||||||
@@ -12,7 +12,7 @@
|
|
||||||
rbtree.o crc32.o firmware_class.o
|
|
||||||
|
|
||||||
obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o \
|
|
||||||
- bust_spinlocks.o rbtree.o dump_stack.o
|
|
||||||
+ bust_spinlocks.o rbtree.o dump_stack.o propolice.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_FW_LOADER) += firmware_class.o
|
|
||||||
obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
|
|
||||||
diff -Naur linux-2.4.26.orig/lib/propolice.c linux-2.4.26.ssp/lib/propolice.c
|
|
||||||
--- linux-2.4.26.orig/lib/propolice.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.26.ssp/lib/propolice.c 2004-04-18 19:54:08.000000000 +0000
|
|
||||||
@@ -0,0 +1,13 @@
|
|
||||||
+ /*
|
|
||||||
+ * linux/lib/errno.c
|
|
||||||
+ *
|
|
||||||
+ *
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+ int __guard = '\0\0\n\777';
|
|
||||||
+
|
|
||||||
+ void __stack_smash_handler (int damaged, char func[])
|
|
||||||
+ {
|
|
||||||
+ static char *message = "propolice detects %x at function %s.\n" ;
|
|
||||||
+ panic (message, damaged, func);
|
|
||||||
+}
|
|
||||||
@@ -1,748 +0,0 @@
|
|||||||
diff -aurN linux-2.4.28-orig/Documentation/Configure.help linux-2.4.28/Documentation/Configure.help
|
|
||||||
--- linux-2.4.28-orig/Documentation/Configure.help 2004-11-17 11:54:20.000000000 +0000
|
|
||||||
+++ linux-2.4.28/Documentation/Configure.help 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -3147,6 +3147,22 @@
|
|
||||||
If you want to compile it as a module, say M here and read
|
|
||||||
<file:Documentation/modules.txt>. If unsure, say `N'.
|
|
||||||
|
|
||||||
+IMQ target support
|
|
||||||
+CONFIG_IP_NF_TARGET_IMQ
|
|
||||||
+ This option adds a `IMQ' target which is used to specify if and
|
|
||||||
+ to which imq device packets should get enqueued/dequeued.
|
|
||||||
+
|
|
||||||
+ If you want to compile it as a module, say M here and read
|
|
||||||
+ <file:Documentation/modules.txt>. If unsure, say `N'.
|
|
||||||
+
|
|
||||||
+IMQ target support
|
|
||||||
+CONFIG_IP6_NF_TARGET_IMQ
|
|
||||||
+ This option adds a `IMQ' target which is used to specify if and
|
|
||||||
+ to which imq device packets should get enqueued/dequeued.
|
|
||||||
+
|
|
||||||
+ If you want to compile it as a module, say M here and read
|
|
||||||
+ <file:Documentation/modules.txt>. If unsure, say `N'.
|
|
||||||
+
|
|
||||||
MARK target support
|
|
||||||
CONFIG_IP_NF_TARGET_MARK
|
|
||||||
This option adds a `MARK' target, which allows you to create rules
|
|
||||||
@@ -9799,6 +9815,20 @@
|
|
||||||
say M here and read <file:Documentation/modules.txt>. The module
|
|
||||||
will be called bonding.o.
|
|
||||||
|
|
||||||
+Intermediate queueing device support
|
|
||||||
+CONFIG_IMQ
|
|
||||||
+ The imq device(s) is used as placeholder for QoS queueing disciplines.
|
|
||||||
+ Every packet entering/leaving the ip stack can be directed through
|
|
||||||
+ the imq device where it's enqueued/dequeued to the attached qdisc.
|
|
||||||
+ This allows you to treat network devices as classes and distribute
|
|
||||||
+ bandwidth among them. Iptables is used to specify through which imq
|
|
||||||
+ device, if any, packets travel.
|
|
||||||
+
|
|
||||||
+ If you want to compile this as a module ( = code which ca be
|
|
||||||
+ inserted in and removed from the running kernel whenever you want),
|
|
||||||
+ say M here and read <file:Documentation/modules.txt>. The module
|
|
||||||
+ will be called imq.o
|
|
||||||
+
|
|
||||||
SLIP (serial line) support
|
|
||||||
CONFIG_SLIP
|
|
||||||
Say Y if you intend to use SLIP or CSLIP (compressed SLIP) to
|
|
||||||
diff -aurN linux-2.4.28-orig/drivers/net/Config.in linux-2.4.28/drivers/net/Config.in
|
|
||||||
--- linux-2.4.28-orig/drivers/net/Config.in 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.28/drivers/net/Config.in 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -7,6 +7,11 @@
|
|
||||||
tristate 'Dummy net driver support' CONFIG_DUMMY
|
|
||||||
tristate 'Bonding driver support' CONFIG_BONDING
|
|
||||||
tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
|
|
||||||
+if [ "$CONFIG_NETFILTER" = "y" ]; then
|
|
||||||
+ tristate 'IMQ (intermediate queueing device) support' CONFIG_IMQ
|
|
||||||
+else
|
|
||||||
+ comment 'IMQ needs CONFIG_NETFILTER enabled'
|
|
||||||
+fi
|
|
||||||
tristate 'Universal TUN/TAP device driver support' CONFIG_TUN
|
|
||||||
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
|
|
||||||
tristate 'Ethertap network tap (OBSOLETE)' CONFIG_ETHERTAP
|
|
||||||
diff -aurN linux-2.4.28-orig/drivers/net/Makefile linux-2.4.28/drivers/net/Makefile
|
|
||||||
--- linux-2.4.28-orig/drivers/net/Makefile 2004-08-07 23:26:04.000000000 +0000
|
|
||||||
+++ linux-2.4.28/drivers/net/Makefile 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -170,6 +170,7 @@
|
|
||||||
|
|
||||||
obj-$(CONFIG_STRIP) += strip.o
|
|
||||||
obj-$(CONFIG_DUMMY) += dummy.o
|
|
||||||
+obj-$(CONFIG_IMQ) += imq.o
|
|
||||||
obj-$(CONFIG_DE600) += de600.o
|
|
||||||
obj-$(CONFIG_DE620) += de620.o
|
|
||||||
obj-$(CONFIG_AT1500) += lance.o
|
|
||||||
diff -aurN linux-2.4.28-orig/drivers/net/imq.c linux-2.4.28/drivers/net/imq.c
|
|
||||||
--- linux-2.4.28-orig/drivers/net/imq.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/drivers/net/imq.c 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -0,0 +1,321 @@
|
|
||||||
+/*
|
|
||||||
+ * Pseudo-driver for the intermediate queue device.
|
|
||||||
+ *
|
|
||||||
+ * This program is free software; you can redistribute it and/or
|
|
||||||
+ * modify it under the terms of the GNU General Public License
|
|
||||||
+ * as published by the Free Software Foundation; either version
|
|
||||||
+ * 2 of the License, or (at your option) any later version.
|
|
||||||
+ *
|
|
||||||
+ * Authors: Patrick McHardy, <kaber@trash.net>
|
|
||||||
+ *
|
|
||||||
+ * The first version was written by Martin Devera, <devik@cdi.cz>
|
|
||||||
+ *
|
|
||||||
+ * Credits: Jan Rafaj <imq2t@cedric.vabo.cz>
|
|
||||||
+ * - Update patch to 2.4.21
|
|
||||||
+ * Sebastian Strollo <sstrollo@nortelnetworks.com>
|
|
||||||
+ * - Fix "Dead-loop on netdevice imq"-issue
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <linux/kernel.h>
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+#include <linux/config.h>
|
|
||||||
+#include <linux/skbuff.h>
|
|
||||||
+#include <linux/netdevice.h>
|
|
||||||
+#include <linux/rtnetlink.h>
|
|
||||||
+#include <linux/if_arp.h>
|
|
||||||
+#include <linux/netfilter.h>
|
|
||||||
+#include <linux/netfilter_ipv4.h>
|
|
||||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
|
||||||
+#include <linux/netfilter_ipv6.h>
|
|
||||||
+#endif
|
|
||||||
+#include <linux/imq.h>
|
|
||||||
+#include <net/pkt_sched.h>
|
|
||||||
+
|
|
||||||
+static nf_hookfn imq_nf_hook;
|
|
||||||
+
|
|
||||||
+static struct nf_hook_ops imq_ingress_ipv4 = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ imq_nf_hook,
|
|
||||||
+ PF_INET,
|
|
||||||
+ NF_IP_PRE_ROUTING,
|
|
||||||
+ NF_IP_PRI_MANGLE + 1
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static struct nf_hook_ops imq_egress_ipv4 = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ imq_nf_hook,
|
|
||||||
+ PF_INET,
|
|
||||||
+ NF_IP_POST_ROUTING,
|
|
||||||
+ NF_IP_PRI_LAST
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
|
||||||
+static struct nf_hook_ops imq_ingress_ipv6 = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ imq_nf_hook,
|
|
||||||
+ PF_INET6,
|
|
||||||
+ NF_IP6_PRE_ROUTING,
|
|
||||||
+ NF_IP6_PRI_MANGLE + 1
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static struct nf_hook_ops imq_egress_ipv6 = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ imq_nf_hook,
|
|
||||||
+ PF_INET6,
|
|
||||||
+ NF_IP6_POST_ROUTING,
|
|
||||||
+ NF_IP6_PRI_LAST
|
|
||||||
+};
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+static unsigned int numdevs = 6;
|
|
||||||
+
|
|
||||||
+MODULE_PARM(numdevs, "i");
|
|
||||||
+MODULE_PARM_DESC(numdevs, "number of imq devices");
|
|
||||||
+
|
|
||||||
+static struct net_device *imq_devs;
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static struct net_device_stats *imq_get_stats(struct net_device *dev)
|
|
||||||
+{
|
|
||||||
+ return (struct net_device_stats *)dev->priv;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* called for packets kfree'd in qdiscs at places other than enqueue */
|
|
||||||
+static void imq_skb_destructor(struct sk_buff *skb)
|
|
||||||
+{
|
|
||||||
+ struct nf_info *info = skb->nf_info;
|
|
||||||
+
|
|
||||||
+ if (info) {
|
|
||||||
+ if (info->indev)
|
|
||||||
+ dev_put(info->indev);
|
|
||||||
+ if (info->outdev)
|
|
||||||
+ dev_put(info->outdev);
|
|
||||||
+ kfree(info);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
|
||||||
+{
|
|
||||||
+ struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
|
|
||||||
+
|
|
||||||
+ stats->tx_bytes += skb->len;
|
|
||||||
+ stats->tx_packets++;
|
|
||||||
+
|
|
||||||
+ skb->imq_flags = 0;
|
|
||||||
+ skb->destructor = NULL;
|
|
||||||
+
|
|
||||||
+ dev->trans_start = jiffies;
|
|
||||||
+ nf_reinject(skb, skb->nf_info, NF_ACCEPT);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info,
|
|
||||||
+ void *data)
|
|
||||||
+{
|
|
||||||
+ struct net_device *dev;
|
|
||||||
+ struct net_device_stats *stats;
|
|
||||||
+ struct sk_buff *skb2 = NULL;
|
|
||||||
+ struct Qdisc *q;
|
|
||||||
+ unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
|
|
||||||
+ int ret = -1;
|
|
||||||
+
|
|
||||||
+ if (index > numdevs)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ dev = imq_devs + index;
|
|
||||||
+ if (!(dev->flags & IFF_UP)) {
|
|
||||||
+ skb->imq_flags = 0;
|
|
||||||
+ nf_reinject(skb, info, NF_ACCEPT);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ dev->last_rx = jiffies;
|
|
||||||
+
|
|
||||||
+ if (skb->destructor) {
|
|
||||||
+ skb2 = skb;
|
|
||||||
+ skb = skb_clone(skb, GFP_ATOMIC);
|
|
||||||
+ if (!skb)
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ skb->nf_info = info;
|
|
||||||
+
|
|
||||||
+ stats = (struct net_device_stats *)dev->priv;
|
|
||||||
+ stats->rx_bytes+= skb->len;
|
|
||||||
+ stats->rx_packets++;
|
|
||||||
+
|
|
||||||
+ spin_lock_bh(&dev->queue_lock);
|
|
||||||
+ q = dev->qdisc;
|
|
||||||
+ if (q->enqueue) {
|
|
||||||
+ q->enqueue(skb_get(skb), q);
|
|
||||||
+ if (skb_shared(skb)) {
|
|
||||||
+ skb->destructor = imq_skb_destructor;
|
|
||||||
+ kfree_skb(skb);
|
|
||||||
+ ret = 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (spin_is_locked(&dev->xmit_lock))
|
|
||||||
+ netif_schedule(dev);
|
|
||||||
+ else
|
|
||||||
+ qdisc_run(dev);
|
|
||||||
+ spin_unlock_bh(&dev->queue_lock);
|
|
||||||
+
|
|
||||||
+ if (skb2)
|
|
||||||
+ kfree_skb(ret ? skb : skb2);
|
|
||||||
+
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff **pskb,
|
|
||||||
+ const struct net_device *indev,
|
|
||||||
+ const struct net_device *outdev,
|
|
||||||
+ int (*okfn)(struct sk_buff *))
|
|
||||||
+{
|
|
||||||
+ if ((*pskb)->imq_flags & IMQ_F_ENQUEUE)
|
|
||||||
+ return NF_QUEUE;
|
|
||||||
+
|
|
||||||
+ return NF_ACCEPT;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+static int __init imq_init_hooks(void)
|
|
||||||
+{
|
|
||||||
+ int err;
|
|
||||||
+
|
|
||||||
+ if ((err = nf_register_queue_handler(PF_INET, imq_nf_queue, NULL)))
|
|
||||||
+ goto err1;
|
|
||||||
+ if ((err = nf_register_hook(&imq_ingress_ipv4)))
|
|
||||||
+ goto err2;
|
|
||||||
+ if ((err = nf_register_hook(&imq_egress_ipv4)))
|
|
||||||
+ goto err3;
|
|
||||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
|
||||||
+ if ((err = nf_register_queue_handler(PF_INET6, imq_nf_queue, NULL)))
|
|
||||||
+ goto err4;
|
|
||||||
+ if ((err = nf_register_hook(&imq_ingress_ipv6)))
|
|
||||||
+ goto err5;
|
|
||||||
+ if ((err = nf_register_hook(&imq_egress_ipv6)))
|
|
||||||
+ goto err6;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
|
||||||
+err6:
|
|
||||||
+ nf_unregister_hook(&imq_ingress_ipv6);
|
|
||||||
+err5:
|
|
||||||
+ nf_unregister_queue_handler(PF_INET6);
|
|
||||||
+err4:
|
|
||||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
|
||||||
+#endif
|
|
||||||
+err3:
|
|
||||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
|
||||||
+err2:
|
|
||||||
+ nf_unregister_queue_handler(PF_INET);
|
|
||||||
+err1:
|
|
||||||
+ return err;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit imq_unhook(void)
|
|
||||||
+{
|
|
||||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
|
||||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
|
||||||
+ nf_unregister_queue_handler(PF_INET);
|
|
||||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
|
||||||
+ nf_unregister_hook(&imq_ingress_ipv6);
|
|
||||||
+ nf_unregister_hook(&imq_egress_ipv6);
|
|
||||||
+ nf_unregister_queue_handler(PF_INET6);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int __init imq_dev_init(struct net_device *dev)
|
|
||||||
+{
|
|
||||||
+ dev->hard_start_xmit = imq_dev_xmit;
|
|
||||||
+ dev->type = ARPHRD_VOID;
|
|
||||||
+ dev->mtu = 1500;
|
|
||||||
+ dev->tx_queue_len = 30;
|
|
||||||
+ dev->flags = IFF_NOARP;
|
|
||||||
+ dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
|
|
||||||
+ if (dev->priv == NULL)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+ memset(dev->priv, 0, sizeof(struct net_device_stats));
|
|
||||||
+ dev->get_stats = imq_get_stats;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void imq_dev_uninit(struct net_device *dev)
|
|
||||||
+{
|
|
||||||
+ kfree(dev->priv);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int __init imq_init_devs(void)
|
|
||||||
+{
|
|
||||||
+ struct net_device *dev;
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ if (!numdevs || numdevs > IMQ_MAX_DEVS) {
|
|
||||||
+ printk(KERN_ERR "numdevs has to be betweed 1 and %u\n",
|
|
||||||
+ IMQ_MAX_DEVS);
|
|
||||||
+ return -EINVAL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ imq_devs = kmalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
|
|
||||||
+ if (!imq_devs)
|
|
||||||
+ return -ENOMEM;
|
|
||||||
+ memset(imq_devs, 0, sizeof(struct net_device) * numdevs);
|
|
||||||
+
|
|
||||||
+ /* we start counting at zero */
|
|
||||||
+ numdevs--;
|
|
||||||
+
|
|
||||||
+ for (i = 0, dev = imq_devs; i <= numdevs; i++, dev++) {
|
|
||||||
+ SET_MODULE_OWNER(dev);
|
|
||||||
+ strcpy(dev->name, "imq%d");
|
|
||||||
+ dev->init = imq_dev_init;
|
|
||||||
+ dev->uninit = imq_dev_uninit;
|
|
||||||
+
|
|
||||||
+ if (register_netdev(dev) < 0)
|
|
||||||
+ goto err_register;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+err_register:
|
|
||||||
+ for (; i; i--)
|
|
||||||
+ unregister_netdev(--dev);
|
|
||||||
+ kfree(imq_devs);
|
|
||||||
+ return -EIO;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void imq_cleanup_devs(void)
|
|
||||||
+{
|
|
||||||
+ int i;
|
|
||||||
+ struct net_device *dev = imq_devs;
|
|
||||||
+
|
|
||||||
+ for (i = 0; i <= numdevs; i++)
|
|
||||||
+ unregister_netdev(dev++);
|
|
||||||
+
|
|
||||||
+ kfree(imq_devs);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int __init imq_init_module(void)
|
|
||||||
+{
|
|
||||||
+ int err;
|
|
||||||
+
|
|
||||||
+ if ((err = imq_init_devs()))
|
|
||||||
+ return err;
|
|
||||||
+ if ((err = imq_init_hooks())) {
|
|
||||||
+ imq_cleanup_devs();
|
|
||||||
+ return err;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ printk(KERN_INFO "imq driver loaded.\n");
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit imq_cleanup_module(void)
|
|
||||||
+{
|
|
||||||
+ imq_unhook();
|
|
||||||
+ imq_cleanup_devs();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(imq_init_module);
|
|
||||||
+module_exit(imq_cleanup_module);
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
diff -aurN linux-2.4.28-orig/include/linux/imq.h linux-2.4.28/include/linux/imq.h
|
|
||||||
--- linux-2.4.28-orig/include/linux/imq.h 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/include/linux/imq.h 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -0,0 +1,9 @@
|
|
||||||
+#ifndef _IMQ_H
|
|
||||||
+#define _IMQ_H
|
|
||||||
+
|
|
||||||
+#define IMQ_MAX_DEVS 16
|
|
||||||
+
|
|
||||||
+#define IMQ_F_IFMASK 0x7f
|
|
||||||
+#define IMQ_F_ENQUEUE 0x80
|
|
||||||
+
|
|
||||||
+#endif /* _IMQ_H */
|
|
||||||
diff -aurN linux-2.4.28-orig/include/linux/netfilter_ipv4/ipt_IMQ.h linux-2.4.28/include/linux/netfilter_ipv4/ipt_IMQ.h
|
|
||||||
--- linux-2.4.28-orig/include/linux/netfilter_ipv4/ipt_IMQ.h 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/include/linux/netfilter_ipv4/ipt_IMQ.h 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -0,0 +1,8 @@
|
|
||||||
+#ifndef _IPT_IMQ_H
|
|
||||||
+#define _IPT_IMQ_H
|
|
||||||
+
|
|
||||||
+struct ipt_imq_info {
|
|
||||||
+ unsigned int todev; /* target imq device */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#endif /* _IPT_IMQ_H */
|
|
||||||
diff -aurN linux-2.4.28-orig/include/linux/netfilter_ipv6/ip6t_IMQ.h linux-2.4.28/include/linux/netfilter_ipv6/ip6t_IMQ.h
|
|
||||||
--- linux-2.4.28-orig/include/linux/netfilter_ipv6/ip6t_IMQ.h 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/include/linux/netfilter_ipv6/ip6t_IMQ.h 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -0,0 +1,8 @@
|
|
||||||
+#ifndef _IP6T_IMQ_H
|
|
||||||
+#define _IP6T_IMQ_H
|
|
||||||
+
|
|
||||||
+struct ip6t_imq_info {
|
|
||||||
+ unsigned int todev; /* target imq device */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#endif /* _IP6T_IMQ_H */
|
|
||||||
diff -aurN linux-2.4.28-orig/include/linux/skbuff.h linux-2.4.28/include/linux/skbuff.h
|
|
||||||
--- linux-2.4.28-orig/include/linux/skbuff.h 2004-08-07 23:26:06.000000000 +0000
|
|
||||||
+++ linux-2.4.28/include/linux/skbuff.h 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -93,6 +93,9 @@
|
|
||||||
struct nf_conntrack *master;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+struct nf_info;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
struct sk_buff_head {
|
|
||||||
/* These two members must be first. */
|
|
||||||
@@ -182,7 +185,7 @@
|
|
||||||
unsigned int len; /* Length of actual data */
|
|
||||||
unsigned int data_len;
|
|
||||||
unsigned int csum; /* Checksum */
|
|
||||||
- unsigned char __unused, /* Dead field, may be reused */
|
|
||||||
+ unsigned char imq_flags, /* intermediate queueing device */
|
|
||||||
cloned, /* head may be cloned (check refcnt to be sure). */
|
|
||||||
pkt_type, /* Packet class */
|
|
||||||
ip_summed; /* Driver fed us an IP checksum */
|
|
||||||
@@ -219,6 +222,9 @@
|
|
||||||
#ifdef CONFIG_NET_SCHED
|
|
||||||
__u32 tc_index; /* traffic control index */
|
|
||||||
#endif
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+ struct nf_info *nf_info;
|
|
||||||
+#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
diff -aurN linux-2.4.28-orig/net/core/skbuff.c linux-2.4.28/net/core/skbuff.c
|
|
||||||
--- linux-2.4.28-orig/net/core/skbuff.c 2003-08-25 11:44:44.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/core/skbuff.c 2004-12-14 11:43:42.000000000 +0000
|
|
||||||
@@ -202,6 +202,10 @@
|
|
||||||
/* Set up other state */
|
|
||||||
skb->len = 0;
|
|
||||||
skb->cloned = 0;
|
|
||||||
+#if defined(CONFIG_IMQ) || defined (CONFIG_IMQ_MODULE)
|
|
||||||
+ skb->imq_flags = 0;
|
|
||||||
+ skb->nf_info = NULL;
|
|
||||||
+#endif
|
|
||||||
skb->data_len = 0;
|
|
||||||
|
|
||||||
atomic_set(&skb->users, 1);
|
|
||||||
@@ -250,6 +254,10 @@
|
|
||||||
#ifdef CONFIG_NET_SCHED
|
|
||||||
skb->tc_index = 0;
|
|
||||||
#endif
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+ skb->imq_flags = 0;
|
|
||||||
+ skb->nf_info = NULL;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void skb_drop_fraglist(struct sk_buff *skb)
|
|
||||||
@@ -400,6 +408,10 @@
|
|
||||||
#ifdef CONFIG_NET_SCHED
|
|
||||||
C(tc_index);
|
|
||||||
#endif
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+ C(imq_flags);
|
|
||||||
+ C(nf_info);
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
atomic_inc(&(skb_shinfo(skb)->dataref));
|
|
||||||
skb->cloned = 1;
|
|
||||||
@@ -444,6 +456,10 @@
|
|
||||||
#ifdef CONFIG_NET_SCHED
|
|
||||||
new->tc_index = old->tc_index;
|
|
||||||
#endif
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+ new->imq_flags=old->imq_flags;
|
|
||||||
+ new->nf_info=old->nf_info;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv4/netfilter/Config.in linux-2.4.28/net/ipv4/netfilter/Config.in
|
|
||||||
--- linux-2.4.28-orig/net/ipv4/netfilter/Config.in 2003-08-25 11:44:44.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv4/netfilter/Config.in 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -104,6 +104,7 @@
|
|
||||||
dep_tristate ' DSCP target support' CONFIG_IP_NF_TARGET_DSCP $CONFIG_IP_NF_MANGLE
|
|
||||||
|
|
||||||
dep_tristate ' MARK target support' CONFIG_IP_NF_TARGET_MARK $CONFIG_IP_NF_MANGLE
|
|
||||||
+ dep_tristate ' IMQ target support' CONFIG_IP_NF_TARGET_IMQ $CONFIG_IP_NF_MANGLE
|
|
||||||
fi
|
|
||||||
dep_tristate ' LOG target support' CONFIG_IP_NF_TARGET_LOG $CONFIG_IP_NF_IPTABLES
|
|
||||||
dep_tristate ' ULOG target support' CONFIG_IP_NF_TARGET_ULOG $CONFIG_IP_NF_IPTABLES
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv4/netfilter/Makefile linux-2.4.28/net/ipv4/netfilter/Makefile
|
|
||||||
--- linux-2.4.28-orig/net/ipv4/netfilter/Makefile 2003-08-25 11:44:44.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv4/netfilter/Makefile 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -94,6 +94,7 @@
|
|
||||||
obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
|
|
||||||
obj-$(CONFIG_IP_NF_TARGET_DSCP) += ipt_DSCP.o
|
|
||||||
obj-$(CONFIG_IP_NF_TARGET_MARK) += ipt_MARK.o
|
|
||||||
+obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
|
|
||||||
obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
|
|
||||||
obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
|
|
||||||
obj-$(CONFIG_IP_NF_NAT_SNMP_BASIC) += ip_nat_snmp_basic.o
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv4/netfilter/ipt_IMQ.c linux-2.4.28/net/ipv4/netfilter/ipt_IMQ.c
|
|
||||||
--- linux-2.4.28-orig/net/ipv4/netfilter/ipt_IMQ.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv4/netfilter/ipt_IMQ.c 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -0,0 +1,78 @@
|
|
||||||
+/* This target marks packets to be enqueued to an imq device */
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+#include <linux/skbuff.h>
|
|
||||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
|
||||||
+#include <linux/netfilter_ipv4/ipt_IMQ.h>
|
|
||||||
+#include <linux/imq.h>
|
|
||||||
+
|
|
||||||
+static unsigned int imq_target(struct sk_buff **pskb,
|
|
||||||
+ unsigned int hooknum,
|
|
||||||
+ const struct net_device *in,
|
|
||||||
+ const struct net_device *out,
|
|
||||||
+ const void *targinfo,
|
|
||||||
+ void *userinfo)
|
|
||||||
+{
|
|
||||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
|
|
||||||
+
|
|
||||||
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
|
||||||
+ (*pskb)->nfcache |= NFC_ALTERED;
|
|
||||||
+
|
|
||||||
+ return IPT_CONTINUE;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int imq_checkentry(const char *tablename,
|
|
||||||
+ const struct ipt_entry *e,
|
|
||||||
+ void *targinfo,
|
|
||||||
+ unsigned int targinfosize,
|
|
||||||
+ unsigned int hook_mask)
|
|
||||||
+{
|
|
||||||
+ struct ipt_imq_info *mr;
|
|
||||||
+
|
|
||||||
+ if (targinfosize != IPT_ALIGN(sizeof(struct ipt_imq_info))) {
|
|
||||||
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ mr = (struct ipt_imq_info*)targinfo;
|
|
||||||
+
|
|
||||||
+ if (strcmp(tablename, "mangle") != 0) {
|
|
||||||
+ printk(KERN_WARNING
|
|
||||||
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
|
|
||||||
+ tablename);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
|
||||||
+ printk(KERN_WARNING
|
|
||||||
+ "IMQ: invalid device specified, highest is %u\n",
|
|
||||||
+ IMQ_MAX_DEVS);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static struct ipt_target ipt_imq_reg = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ "IMQ",
|
|
||||||
+ imq_target,
|
|
||||||
+ imq_checkentry,
|
|
||||||
+ NULL,
|
|
||||||
+ THIS_MODULE
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int __init init(void)
|
|
||||||
+{
|
|
||||||
+ if (ipt_register_target(&ipt_imq_reg))
|
|
||||||
+ return -EINVAL;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit fini(void)
|
|
||||||
+{
|
|
||||||
+ ipt_unregister_target(&ipt_imq_reg);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(init);
|
|
||||||
+module_exit(fini);
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv6/netfilter/Config.in linux-2.4.28/net/ipv6/netfilter/Config.in
|
|
||||||
--- linux-2.4.28-orig/net/ipv6/netfilter/Config.in 2003-06-13 14:51:39.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv6/netfilter/Config.in 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -71,6 +71,7 @@
|
|
||||||
if [ "$CONFIG_IP6_NF_MANGLE" != "n" ]; then
|
|
||||||
# dep_tristate ' TOS target support' CONFIG_IP6_NF_TARGET_TOS $CONFIG_IP_NF_MANGLE
|
|
||||||
dep_tristate ' MARK target support' CONFIG_IP6_NF_TARGET_MARK $CONFIG_IP6_NF_MANGLE
|
|
||||||
+ dep_tristate ' IMQ target support' CONFIG_IP6_NF_TARGET_IMQ $CONFIG_IP6_NF_MANGLE
|
|
||||||
fi
|
|
||||||
#dep_tristate ' LOG target support' CONFIG_IP6_NF_TARGET_LOG $CONFIG_IP6_NF_IPTABLES
|
|
||||||
fi
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv6/netfilter/Makefile linux-2.4.28/net/ipv6/netfilter/Makefile
|
|
||||||
--- linux-2.4.28-orig/net/ipv6/netfilter/Makefile 2003-06-13 14:51:39.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv6/netfilter/Makefile 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -28,6 +28,7 @@
|
|
||||||
obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
|
|
||||||
obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
|
|
||||||
obj-$(CONFIG_IP6_NF_TARGET_MARK) += ip6t_MARK.o
|
|
||||||
+obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
|
|
||||||
obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
|
|
||||||
obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o
|
|
||||||
obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o
|
|
||||||
diff -aurN linux-2.4.28-orig/net/ipv6/netfilter/ip6t_IMQ.c linux-2.4.28/net/ipv6/netfilter/ip6t_IMQ.c
|
|
||||||
--- linux-2.4.28-orig/net/ipv6/netfilter/ip6t_IMQ.c 1970-01-01 00:00:00.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/ipv6/netfilter/ip6t_IMQ.c 2004-12-14 11:43:43.000000000 +0000
|
|
||||||
@@ -0,0 +1,78 @@
|
|
||||||
+/* This target marks packets to be enqueued to an imq device */
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+#include <linux/skbuff.h>
|
|
||||||
+#include <linux/netfilter_ipv6/ip6_tables.h>
|
|
||||||
+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
|
|
||||||
+#include <linux/imq.h>
|
|
||||||
+
|
|
||||||
+static unsigned int imq_target(struct sk_buff **pskb,
|
|
||||||
+ unsigned int hooknum,
|
|
||||||
+ const struct net_device *in,
|
|
||||||
+ const struct net_device *out,
|
|
||||||
+ const void *targinfo,
|
|
||||||
+ void *userinfo)
|
|
||||||
+{
|
|
||||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
|
|
||||||
+
|
|
||||||
+ (*pskb)->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
|
||||||
+ (*pskb)->nfcache |= NFC_ALTERED;
|
|
||||||
+
|
|
||||||
+ return IP6T_CONTINUE;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int imq_checkentry(const char *tablename,
|
|
||||||
+ const struct ip6t_entry *e,
|
|
||||||
+ void *targinfo,
|
|
||||||
+ unsigned int targinfosize,
|
|
||||||
+ unsigned int hook_mask)
|
|
||||||
+{
|
|
||||||
+ struct ip6t_imq_info *mr;
|
|
||||||
+
|
|
||||||
+ if (targinfosize != IP6T_ALIGN(sizeof(struct ip6t_imq_info))) {
|
|
||||||
+ printk(KERN_WARNING "IMQ: invalid targinfosize\n");
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ mr = (struct ip6t_imq_info*)targinfo;
|
|
||||||
+
|
|
||||||
+ if (strcmp(tablename, "mangle") != 0) {
|
|
||||||
+ printk(KERN_WARNING
|
|
||||||
+ "IMQ: IMQ can only be called from \"mangle\" table, not \"%s\"\n",
|
|
||||||
+ tablename);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
|
||||||
+ printk(KERN_WARNING
|
|
||||||
+ "IMQ: invalid device specified, highest is %u\n",
|
|
||||||
+ IMQ_MAX_DEVS);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static struct ip6t_target ip6t_imq_reg = {
|
|
||||||
+ { NULL, NULL},
|
|
||||||
+ "IMQ",
|
|
||||||
+ imq_target,
|
|
||||||
+ imq_checkentry,
|
|
||||||
+ NULL,
|
|
||||||
+ THIS_MODULE
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int __init init(void)
|
|
||||||
+{
|
|
||||||
+ if (ip6t_register_target(&ip6t_imq_reg))
|
|
||||||
+ return -EINVAL;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit fini(void)
|
|
||||||
+{
|
|
||||||
+ ip6t_unregister_target(&ip6t_imq_reg);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(init);
|
|
||||||
+module_exit(fini);
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
diff -aurN linux-2.4.28-orig/net/sched/sch_generic.c linux-2.4.28/net/sched/sch_generic.c
|
|
||||||
--- linux-2.4.28-orig/net/sched/sch_generic.c 2004-11-17 11:54:22.000000000 +0000
|
|
||||||
+++ linux-2.4.28/net/sched/sch_generic.c 2004-12-14 11:44:27.000000000 +0000
|
|
||||||
@@ -29,6 +29,9 @@
|
|
||||||
#include <linux/skbuff.h>
|
|
||||||
#include <linux/rtnetlink.h>
|
|
||||||
#include <linux/init.h>
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+#include <linux/imq.h>
|
|
||||||
+#endif
|
|
||||||
#include <linux/list.h>
|
|
||||||
#include <net/sock.h>
|
|
||||||
#include <net/pkt_sched.h>
|
|
||||||
@@ -90,7 +93,11 @@
|
|
||||||
spin_unlock(&dev->queue_lock);
|
|
||||||
|
|
||||||
if (!netif_queue_stopped(dev)) {
|
|
||||||
- if (netdev_nit)
|
|
||||||
+ if (netdev_nit
|
|
||||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
|
||||||
+ && !(skb->imq_flags & IMQ_F_ENQUEUE)
|
|
||||||
+#endif
|
|
||||||
+ )
|
|
||||||
dev_queue_xmit_nit(skb, dev);
|
|
||||||
|
|
||||||
if (dev->hard_start_xmit(skb, dev) == 0) {
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
--- linux-2.4.29/drivers/net/r8169.c.origin Sun Aug 8 01:26:05 2004
|
|
||||||
+++ linux-2.4.29/drivers/net/r8169.c Sat Feb 12 08:08:58 2005
|
|
||||||
@@ -145,6 +145,7 @@
|
|
||||||
|
|
||||||
static struct pci_device_id rtl8169_pci_tbl[] = {
|
|
||||||
{0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
|
||||||
+ {0x1186, 0x4300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
|
|
||||||
{0,},
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- Makefile~ 2006-06-28 17:13:56.576988264 +0200
|
|
||||||
+++ Makefile 2006-06-29 18:09:22.000000000 +0200
|
|
||||||
@@ -1,7 +1,7 @@
|
|
||||||
VERSION = 2
|
|
||||||
PATCHLEVEL = 4
|
|
||||||
SUBLEVEL = 31
|
|
||||||
-EXTRAVERSION =
|
|
||||||
+EXTRAVERSION = -ipfire
|
|
||||||
|
|
||||||
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
--- linux/drivers/ide/pci/sis5513.c.old 2004-08-08 01:26:04.000000000 +0200
|
|
||||||
+++ linux/drivers/ide/pci/sis5513.c 2006-07-16 02:00:51.000000000 +0200
|
|
||||||
@@ -789,6 +789,10 @@
|
|
||||||
printk(KERN_INFO "SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller\n");
|
|
||||||
chipset_family = ATA_133;
|
|
||||||
}
|
|
||||||
+ if (trueid == 0x180) { /* sis965L */
|
|
||||||
+ printk(KERN_INFO "SIS5513: SiS 965L IDE UDMA133 controller\n");
|
|
||||||
+ chipset_family = ATA_133;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!chipset_family) { /* Belongs to pci-quirks */
|
|
||||||
@@ -1,410 +0,0 @@
|
|||||||
--- make_devices.old 2004-08-16 11:43:04.071634753 +0100
|
|
||||||
+++ make_devices 2004-08-16 11:38:51.096251388 +0100
|
|
||||||
@@ -137,10 +137,10 @@
|
|
||||||
mknod -m $MODE tty6 c 4 6 ; chgrp $GROUP tty6
|
|
||||||
mknod -m $MODE tty7 c 4 7 ; chgrp $GROUP tty7
|
|
||||||
mknod -m $MODE tty8 c 4 8 ; chgrp $GROUP tty8
|
|
||||||
- # mknod -m $MODE tty9 c 4 9 ; chgrp $GROUP tty9
|
|
||||||
- # mknod -m $MODE tty10 c 4 10 ; chgrp $GROUP tty10
|
|
||||||
- # mknod -m $MODE tty11 c 4 11 ; chgrp $GROUP tty11
|
|
||||||
- # mknod -m $MODE tty12 c 4 12 ; chgrp $GROUP tty12
|
|
||||||
+mknod -m $MODE tty9 c 4 9 ; chgrp $GROUP tty9
|
|
||||||
+mknod -m $MODE tty10 c 4 10 ; chgrp $GROUP tty10
|
|
||||||
+mknod -m $MODE tty11 c 4 11 ; chgrp $GROUP tty11
|
|
||||||
+mknod -m $MODE tty12 c 4 12 ; chgrp $GROUP tty12
|
|
||||||
# mknod -m $MODE tty13 c 4 13 ; chgrp $GROUP tty13
|
|
||||||
# mknod -m $MODE tty14 c 4 14 ; chgrp $GROUP tty14
|
|
||||||
# mknod -m $MODE tty15 c 4 15 ; chgrp $GROUP tty15
|
|
||||||
@@ -295,8 +295,8 @@
|
|
||||||
mknod -m $MODE ram0 b 1 0 ; chgrp $GROUP ram0
|
|
||||||
# Second RAM disk
|
|
||||||
mknod -m $MODE ram1 b 1 1 ; chgrp $GROUP ram1
|
|
||||||
- # mknod -m $MODE ram2 b 1 2 ; chgrp $GROUP ram2
|
|
||||||
- # mknod -m $MODE ram3 b 1 3 ; chgrp $GROUP ram3
|
|
||||||
+mknod -m $MODE ram2 b 1 2 ; chgrp $GROUP ram2
|
|
||||||
+mknod -m $MODE ram3 b 1 3 ; chgrp $GROUP ram3
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# Initial RAM disk {2.6}
|
|
||||||
@@ -324,6 +324,8 @@
|
|
||||||
mknod -m $MODE loop0 b 7 0 ; chgrp $GROUP loop0
|
|
||||||
# Second loopback device
|
|
||||||
mknod -m $MODE loop1 b 7 1 ; chgrp $GROUP loop1
|
|
||||||
+mknod -m $MODE loop2 b 7 2 ; chgrp $GROUP loop2
|
|
||||||
+mknod -m $MODE loop3 b 7 3 ; chgrp $GROUP loop3
|
|
||||||
# ...
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
@@ -357,36 +359,52 @@
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# Third IDE disk whole disk (or CD-ROM)
|
|
||||||
- # mknod -m $MODE hdc b 22 0 ; chgrp $GROUP hdc
|
|
||||||
+mknod -m $MODE hdc b 22 0 ; chgrp $GROUP hdc
|
|
||||||
# First partition on hdc
|
|
||||||
- # mknod -m $MODE hdc1 b 22 1 ; chgrp $GROUP hdc1
|
|
||||||
+mknod -m $MODE hdc1 b 22 1 ; chgrp $GROUP hdc1
|
|
||||||
# Second partition on hdc
|
|
||||||
- # mknod -m $MODE hdc2 b 22 2 ; chgrp $GROUP hdc2
|
|
||||||
- # ...
|
|
||||||
+mknod -m $MODE hdc2 b 22 2 ; chgrp $GROUP hdc2
|
|
||||||
+mknod -m $MODE hdc3 b 22 3 ; chgrp $GROUP hdc3
|
|
||||||
+mknod -m $MODE hdc4 b 22 4 ; chgrp $GROUP hdc4
|
|
||||||
+mknod -m $MODE hdc5 b 22 5 ; chgrp $GROUP hdc5
|
|
||||||
+mknod -m $MODE hdc6 b 22 6 ; chgrp $GROUP hdc6
|
|
||||||
+mknod -m $MODE hdc7 b 22 7 ; chgrp $GROUP hdc7
|
|
||||||
|
|
||||||
# Fourth IDE disk whole disk (or CD-ROM)
|
|
||||||
- # mknod -m $MODE hdd b 22 64 ; chgrp $GROUP hdd
|
|
||||||
+mknod -m $MODE hdd b 22 64 ; chgrp $GROUP hdd
|
|
||||||
# First partition on hdd
|
|
||||||
- # mknod -m $MODE hdd1 b 22 65 ; chgrp $GROUP hdd1
|
|
||||||
+mknod -m $MODE hdd1 b 22 65 ; chgrp $GROUP hdd1
|
|
||||||
# Second partition on hdd
|
|
||||||
- # mknod -m $MODE hdd2 b 22 66 ; chgrp $GROUP hdd2
|
|
||||||
- # ...
|
|
||||||
+mknod -m $MODE hdd2 b 22 66 ; chgrp $GROUP hdd2
|
|
||||||
+mknod -m $MODE hdd3 b 22 67 ; chgrp $GROUP hdd3
|
|
||||||
+mknod -m $MODE hdd4 b 22 68 ; chgrp $GROUP hdd4
|
|
||||||
+mknod -m $MODE hdd5 b 22 69 ; chgrp $GROUP hdd5
|
|
||||||
+mknod -m $MODE hdd6 b 22 70 ; chgrp $GROUP hdd6
|
|
||||||
+mknod -m $MODE hdd7 b 22 71 ; chgrp $GROUP hdd7
|
|
||||||
|
|
||||||
# Fifth IDE disk whole disk (or CD-ROM)
|
|
||||||
- # mknod -m $MODE hde b 33 0 ; chgrp $GROUP hde
|
|
||||||
+mknod -m $MODE hde b 33 0 ; chgrp $GROUP hde
|
|
||||||
# First partition on hde
|
|
||||||
- # mknod -m $MODE hde1 b 33 1 ; chgrp $GROUP hde1
|
|
||||||
+mknod -m $MODE hde1 b 33 1 ; chgrp $GROUP hde1
|
|
||||||
# Second partition on hde
|
|
||||||
- # mknod -m $MODE hde2 b 33 2 ; chgrp $GROUP hde2
|
|
||||||
- # ...
|
|
||||||
+mknod -m $MODE hde2 b 33 2 ; chgrp $GROUP hde2
|
|
||||||
+mknod -m $MODE hde3 b 33 3 ; chgrp $GROUP hde3
|
|
||||||
+mknod -m $MODE hde4 b 33 4 ; chgrp $GROUP hde4
|
|
||||||
+mknod -m $MODE hde5 b 33 5 ; chgrp $GROUP hde5
|
|
||||||
+mknod -m $MODE hde6 b 33 6 ; chgrp $GROUP hde6
|
|
||||||
+mknod -m $MODE hde7 b 33 7 ; chgrp $GROUP hde7
|
|
||||||
|
|
||||||
# Sixth IDE disk whole disk (or CD-ROM)
|
|
||||||
- # mknod -m $MODE hdf b 33 64 ; chgrp $GROUP hdf
|
|
||||||
+mknod -m $MODE hdf b 33 64 ; chgrp $GROUP hdf
|
|
||||||
# First partition on hdf
|
|
||||||
- # mknod -m $MODE hdf1 b 33 65 ; chgrp $GROUP hdf1
|
|
||||||
+mknod -m $MODE hdf1 b 33 65 ; chgrp $GROUP hdf1
|
|
||||||
# Second partition on hdf
|
|
||||||
- # mknod -m $MODE hdf2 b 33 66 ; chgrp $GROUP hdf2
|
|
||||||
- # ...
|
|
||||||
+mknod -m $MODE hdf2 b 33 66 ; chgrp $GROUP hdf2
|
|
||||||
+mknod -m $MODE hdf3 b 33 67 ; chgrp $GROUP hdf3
|
|
||||||
+mknod -m $MODE hdf4 b 33 68 ; chgrp $GROUP hdf4
|
|
||||||
+mknod -m $MODE hdf5 b 33 69 ; chgrp $GROUP hdf5
|
|
||||||
+mknod -m $MODE hdf6 b 33 70 ; chgrp $GROUP hdf6
|
|
||||||
+mknod -m $MODE hdf7 b 33 71 ; chgrp $GROUP hdf7
|
|
||||||
|
|
||||||
# Seventh IDE disk whole disk (or CD-ROM)
|
|
||||||
# mknod -m $MODE hdg b 34 0 ; chgrp $GROUP hdg
|
|
||||||
@@ -435,20 +453,26 @@
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# Third SCSI disk whole disk
|
|
||||||
- # mknod -m $MODE sdc b 8 32 ; chgrp $GROUP sdc
|
|
||||||
+mknod -m $MODE sdc b 8 32 ; chgrp $GROUP sdc
|
|
||||||
# First partition on sdc
|
|
||||||
- # mknod -m $MODE sdc1 b 8 33 ; chgrp $GROUP sdc1
|
|
||||||
+mknod -m $MODE sdc1 b 8 33 ; chgrp $GROUP sdc1
|
|
||||||
# Second partition on sdc
|
|
||||||
- # mknod -m $MODE sdc2 b 8 34 ; chgrp $GROUP sdc2
|
|
||||||
- # mknod -m $MODE sdc3 b 8 35 ; chgrp $GROUP sdc3
|
|
||||||
- # mknod -m $MODE sdc4 b 8 36 ; chgrp $GROUP sdc4
|
|
||||||
- # mknod -m $MODE sdc5 b 8 37 ; chgrp $GROUP sdc5
|
|
||||||
- # mknod -m $MODE sdc6 b 8 38 ; chgrp $GROUP sdc6
|
|
||||||
- # mknod -m $MODE sdc7 b 8 39 ; chgrp $GROUP sdc7
|
|
||||||
- # ...
|
|
||||||
-
|
|
||||||
- # mknod -m $MODE sdd b 8 48 ; chgrp $GROUP sdd
|
|
||||||
- # mknod -m $MODE sdd1 b 8 49 ; chgrp $GROUP sdd1
|
|
||||||
+mknod -m $MODE sdc2 b 8 34 ; chgrp $GROUP sdc2
|
|
||||||
+mknod -m $MODE sdc3 b 8 35 ; chgrp $GROUP sdc3
|
|
||||||
+mknod -m $MODE sdc4 b 8 36 ; chgrp $GROUP sdc4
|
|
||||||
+mknod -m $MODE sdc5 b 8 37 ; chgrp $GROUP sdc5
|
|
||||||
+mknod -m $MODE sdc6 b 8 38 ; chgrp $GROUP sdc6
|
|
||||||
+mknod -m $MODE sdc7 b 8 39 ; chgrp $GROUP sdc7
|
|
||||||
+ # ...
|
|
||||||
+
|
|
||||||
+mknod -m $MODE sdd b 8 48 ; chgrp $GROUP sdd
|
|
||||||
+mknod -m $MODE sdd1 b 8 49 ; chgrp $GROUP sdd1
|
|
||||||
+mknod -m $MODE sdd2 b 8 50 ; chgrp $GROUP sdd2
|
|
||||||
+mknod -m $MODE sdd3 b 8 51 ; chgrp $GROUP sdd3
|
|
||||||
+mknod -m $MODE sdd4 b 8 52 ; chgrp $GROUP sdd4
|
|
||||||
+mknod -m $MODE sdd5 b 8 53 ; chgrp $GROUP sdd5
|
|
||||||
+mknod -m $MODE sdd6 b 8 54 ; chgrp $GROUP sdd6
|
|
||||||
+mknod -m $MODE sdd7 b 8 55 ; chgrp $GROUP sdd7
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# mknod -m $MODE sde b 8 64 ; chgrp $GROUP sde
|
|
||||||
@@ -471,6 +495,35 @@
|
|
||||||
# mknod -m $MODE sdp15 b 8 255 ; chgrp $GROUP sdp15
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
+# Raid Array disk devices
|
|
||||||
+#****************************************************************************
|
|
||||||
+
|
|
||||||
+mkdir -p ida
|
|
||||||
+mknod -m $MODE ida/c0d0 b 72 0 ; chgrp $GROUP ida/c0d0
|
|
||||||
+mknod -m $MODE ida/c0d0p1 b 72 1 ; chgrp $GROUP ida/c0d0p1
|
|
||||||
+mknod -m $MODE ida/c0d0p2 b 72 2 ; chgrp $GROUP ida/c0d0p2
|
|
||||||
+mknod -m $MODE ida/c0d0p3 b 72 3 ; chgrp $GROUP ida/c0d0p3
|
|
||||||
+mknod -m $MODE ida/c0d0p4 b 72 4 ; chgrp $GROUP ida/c0d0p4
|
|
||||||
+mkdir -p cciss
|
|
||||||
+mknod -m $MODE cciss/c0d0 b 104 0 ; chgrp $GROUP cciss/c0d0
|
|
||||||
+mknod -m $MODE cciss/c0d0p1 b 104 1 ; chgrp $GROUP cciss/c0d0p1
|
|
||||||
+mknod -m $MODE cciss/c0d0p2 b 104 2 ; chgrp $GROUP cciss/c0d0p2
|
|
||||||
+mknod -m $MODE cciss/c0d0p3 b 104 3 ; chgrp $GROUP cciss/c0d0p3
|
|
||||||
+mknod -m $MODE cciss/c0d0p4 b 104 4 ; chgrp $GROUP cciss/c0d0p4
|
|
||||||
+mkdir -p rd
|
|
||||||
+mknod -m $MODE rd/c0d0 b 48 0 ; chgrp $GROUP rd/c0d0
|
|
||||||
+mknod -m $MODE rd/c0d0p1 b 48 1 ; chgrp $GROUP rd/c0d0p1
|
|
||||||
+mknod -m $MODE rd/c0d0p2 b 48 2 ; chgrp $GROUP rd/c0d0p2
|
|
||||||
+mknod -m $MODE rd/c0d0p3 b 48 3 ; chgrp $GROUP rd/c0d0p3
|
|
||||||
+mknod -m $MODE rd/c0d0p4 b 48 4 ; chgrp $GROUP rd/c0d0p4
|
|
||||||
+mkdir -p ataraid
|
|
||||||
+mknod -m $MODE ataraid/d0 b 114 0 ; chgrp $GROUP ataraid/d0
|
|
||||||
+mknod -m $MODE ataraid/d0p1 b 114 1 ; chgrp $GROUP ataraid/d0p1
|
|
||||||
+mknod -m $MODE ataraid/d0p2 b 114 2 ; chgrp $GROUP ataraid/d0p2
|
|
||||||
+mknod -m $MODE ataraid/d0p3 b 114 3 ; chgrp $GROUP ataraid/d0p3
|
|
||||||
+mknod -m $MODE ataraid/d0p4 b 114 4 ; chgrp $GROUP ataraid/d0p4
|
|
||||||
+
|
|
||||||
+#****************************************************************************
|
|
||||||
# Parallel port IDE disk devices
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
@@ -810,9 +863,9 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First generic SCSI device
|
|
||||||
- # mknod -m $MODE sg0 c 21 0 ; chgrp $GROUP sg0
|
|
||||||
+mknod -m $MODE sg0 c 21 0 ; chgrp $GROUP sg0
|
|
||||||
# Second generic SCSI device
|
|
||||||
- # mknod -m $MODE sg1 c 21 1 ; chgrp $GROUP sg1
|
|
||||||
+mknod -m $MODE sg1 c 21 1 ; chgrp $GROUP sg1
|
|
||||||
# mknod -m $MODE sg2 c 21 2 ; chgrp $GROUP sg2
|
|
||||||
# mknod -m $MODE sg3 c 21 3 ; chgrp $GROUP sg3
|
|
||||||
# ...
|
|
||||||
@@ -832,11 +885,15 @@
|
|
||||||
mknod -m $MODE scd0 b 11 0 ; chgrp $GROUP scd0
|
|
||||||
# Second SCSI CD-ROM
|
|
||||||
mknod -m $MODE scd1 b 11 1 ; chgrp $GROUP scd1
|
|
||||||
+mknod -m $MODE scd2 b 11 2 ; chgrp $GROUP scd2
|
|
||||||
+mknod -m $MODE scd3 b 11 3 ; chgrp $GROUP scd3
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# Alternative names for SCSI CD-ROMs (_hard_ links)
|
|
||||||
ln -fn scd0 sr0 ; chgrp $GROUP sr0
|
|
||||||
ln -fn scd1 sr1 ; chgrp $GROUP sr1
|
|
||||||
+ln -fn scd1 sr2 ; chgrp $GROUP sr2
|
|
||||||
+ln -fn scd1 sr3 ; chgrp $GROUP sr3
|
|
||||||
# ...
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
@@ -1027,6 +1084,7 @@
|
|
||||||
mknod -m $MODE ttyS1 c 4 65 ; chgrp $GROUP ttyS1
|
|
||||||
mknod -m $MODE ttyS2 c 4 66 ; chgrp $GROUP ttyS2
|
|
||||||
mknod -m $MODE ttyS3 c 4 67 ; chgrp $GROUP ttyS3
|
|
||||||
+mknod -m $MODE ttyS4 c 4 68 ; chgrp $GROUP ttyS4
|
|
||||||
# ...
|
|
||||||
# 192nd UART serial port
|
|
||||||
# mknod -m $MODE ttyS191 c 4 255 ; chgrp $GROUP ttyS191
|
|
||||||
@@ -1036,16 +1094,16 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# Device independent PPP interface
|
|
||||||
- # mknod -m $MODE ppp c 108 0 ; chgrp $GROUP ppp
|
|
||||||
+mknod -m $MODE ppp c 108 0 ; chgrp $GROUP ppp
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
# isdn4linux virtual modem
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First virtual modem
|
|
||||||
- # mknod -m $MODE ttyI0 c 43 0 ; chgrp $GROUP ttyI0
|
|
||||||
+mknod -m $MODE ttyI0 c 43 0 ; chgrp $GROUP ttyI0
|
|
||||||
# Second virtual modem
|
|
||||||
- # mknod -m $MODE ttyI1 c 43 1 ; chgrp $GROUP ttyI1
|
|
||||||
+mknod -m $MODE ttyI1 c 43 1 ; chgrp $GROUP ttyI1
|
|
||||||
# ...
|
|
||||||
# 64th virtual modem
|
|
||||||
# mknod -m $MODE ttyI63 c 43 63 ; chgrp $GROUP ttyI63
|
|
||||||
@@ -1055,37 +1113,37 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First virtual B channel raw data
|
|
||||||
- # mknod -m $MODE isdn0 c 45 0 ; chgrp $GROUP isdn0
|
|
||||||
- # mknod -m $MODE isdn1 c 45 1 ; chgrp $GROUP isdn1
|
|
||||||
+mknod -m $MODE isdn0 c 45 0 ; chgrp $GROUP isdn0
|
|
||||||
+mknod -m $MODE isdn1 c 45 1 ; chgrp $GROUP isdn1
|
|
||||||
# ...
|
|
||||||
# 64th virtual B channel raw data
|
|
||||||
# mknod -m $MODE isdn63 c 45 63 ; chgrp $GROUP isdn63
|
|
||||||
|
|
||||||
# First channel control/debug
|
|
||||||
- # mknod -m $MODE isdnctrl0 c 45 64 ; chgrp $GROUP isdnctrl0
|
|
||||||
- # mknod -m $MODE isdnctrl1 c 45 65 ; chgrp $GROUP isdnctrl1
|
|
||||||
+mknod -m $MODE isdnctrl0 c 45 64 ; chgrp $GROUP isdnctrl0
|
|
||||||
+mknod -m $MODE isdnctrl1 c 45 65 ; chgrp $GROUP isdnctrl1
|
|
||||||
# ...
|
|
||||||
# 64th channel control/debug
|
|
||||||
# mknod -m $MODE isdnctrl63 c 45 127 ; chgrp $GROUP isdnctrl63
|
|
||||||
|
|
||||||
# First SyncPPP device
|
|
||||||
- # mknod -m $MODE ippp0 c 45 128 ; chgrp $GROUP ippp0
|
|
||||||
- # mknod -m $MODE ippp1 c 45 129 ; chgrp $GROUP ippp1
|
|
||||||
+mknod -m $MODE ippp0 c 45 128 ; chgrp $GROUP ippp0
|
|
||||||
+mknod -m $MODE ippp1 c 45 129 ; chgrp $GROUP ippp1
|
|
||||||
# ...
|
|
||||||
# 64th SyncPPP device
|
|
||||||
# mknod -m $MODE ippp63 c 45 191 ; chgrp $GROUP ippp63
|
|
||||||
|
|
||||||
# ISDN monitor interface
|
|
||||||
- # mknod -m $MODE isdninfo c 45 255 ; chgrp $GROUP isdninfo
|
|
||||||
+mknod -m $MODE isdninfo c 45 255 ; chgrp $GROUP isdninfo
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
# USB serial converters
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First USB serial converter
|
|
||||||
- # mknod -m $MODE ttyUSB0 c 188 0 ; chgrp $GROUP ttyUSB0
|
|
||||||
+mknod -m $MODE ttyUSB0 c 188 0 ; chgrp $GROUP ttyUSB0
|
|
||||||
# Second USB serial converter
|
|
||||||
- # mknod -m $MODE ttyUSB1 c 188 1 ; chgrp $GROUP ttyUSB1
|
|
||||||
+mknod -m $MODE ttyUSB1 c 188 1 ; chgrp $GROUP ttyUSB1
|
|
||||||
# ...
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
@@ -1093,9 +1151,9 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First ACM modem
|
|
||||||
- # mknod -m $MODE ttyACM0 c 166 0 ; chgrp $GROUP ttyACM0
|
|
||||||
+mknod -m $MODE ttyACM0 c 166 0 ; chgrp $GROUP ttyACM0
|
|
||||||
# Second ACM modem
|
|
||||||
- # mknod -m $MODE ttyACM1 c 166 1 ; chgrp $GROUP ttyACM1
|
|
||||||
+mknod -m $MODE ttyACM1 c 166 1 ; chgrp $GROUP ttyACM1
|
|
||||||
# ...
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
@@ -1123,9 +1181,9 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First DataComm card
|
|
||||||
- # mknod -m $MODE dcbri0 c 52 0 ; chgrp $GROUP dcbri0
|
|
||||||
+mknod -m $MODE dcbri0 c 52 0 ; chgrp $GROUP dcbri0
|
|
||||||
# Second DataComm card
|
|
||||||
- # mknod -m $MODE dcbri1 c 52 1 ; chgrp $GROUP dcbri1
|
|
||||||
+mknod -m $MODE dcbri1 c 52 1 ; chgrp $GROUP dcbri1
|
|
||||||
# Third DataComm card
|
|
||||||
# mknod -m $MODE dcbri2 c 52 2 ; chgrp $GROUP dcbri2
|
|
||||||
# Fourth DataComm card
|
|
||||||
@@ -2144,10 +2202,10 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# Control device
|
|
||||||
- # mknod -m $MODE capi20 c 68 0 ; chgrp $GROUP capi20
|
|
||||||
+mknod -m $MODE capi20 c 68 0 ; chgrp $GROUP capi20
|
|
||||||
|
|
||||||
# First CAPI 2.0 application
|
|
||||||
- # mknod -m $MODE capi20.00 c 68 1 ; chgrp $GROUP capi20.00
|
|
||||||
+mknod -m $MODE capi20.00 c 68 1 ; chgrp $GROUP capi20.00
|
|
||||||
# Second CAPI 2.0 application
|
|
||||||
# mknod -m $MODE capi20.01 c 68 2 ; chgrp $GROUP capi20.01
|
|
||||||
# ...
|
|
||||||
@@ -2169,16 +2227,16 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# Filter control device/log file
|
|
||||||
- # mknod -m $MODE ipl c 95 0 ; chgrp $GROUP ipl
|
|
||||||
+mknod -m $MODE ipl c 95 0 ; chgrp $GROUP ipl
|
|
||||||
|
|
||||||
# NAT control device/log file
|
|
||||||
- # mknod -m $MODE ipnat c 95 1 ; chgrp $GROUP ipnat
|
|
||||||
+mknod -m $MODE ipnat c 95 1 ; chgrp $GROUP ipnat
|
|
||||||
|
|
||||||
# State information log file
|
|
||||||
- # mknod -m $MODE ipstate c 95 2 ; chgrp $GROUP ipstate
|
|
||||||
+mknod -m $MODE ipstate c 95 2 ; chgrp $GROUP ipstate
|
|
||||||
|
|
||||||
# Authentication control device/log file
|
|
||||||
- # mknod -m $MODE ipauth c 95 3 ; chgrp $GROUP ipauth
|
|
||||||
+mknod -m $MODE ipauth c 95 3 ; chgrp $GROUP ipauth
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
# Raw keyboard device
|
|
||||||
@@ -2316,51 +2374,51 @@
|
|
||||||
#****************************************************************************
|
|
||||||
|
|
||||||
# First SCSI tape, mode 0
|
|
||||||
- # mknod -m $MODE st0 c 9 0 ; chgrp $GROUP st0
|
|
||||||
+mknod -m $MODE st0 c 9 0 ; chgrp $GROUP st0
|
|
||||||
# Second SCSI tape, mode 0
|
|
||||||
- # mknod -m $MODE st1 c 9 1 ; chgrp $GROUP st1
|
|
||||||
+mknod -m $MODE st1 c 9 1 ; chgrp $GROUP st1
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 1
|
|
||||||
- # mknod -m $MODE st0l c 9 32 ; chgrp $GROUP st0l
|
|
||||||
+mknod -m $MODE st0l c 9 32 ; chgrp $GROUP st0l
|
|
||||||
# Second SCSI tape, mode 1
|
|
||||||
- # mknod -m $MODE st1l c 9 33 ; chgrp $GROUP st1l
|
|
||||||
+mknod -m $MODE st1l c 9 33 ; chgrp $GROUP st1l
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 2
|
|
||||||
- # mknod -m $MODE st0m c 9 64 ; chgrp $GROUP st0m
|
|
||||||
+mknod -m $MODE st0m c 9 64 ; chgrp $GROUP st0m
|
|
||||||
# Second SCSI tape, mode 2
|
|
||||||
- # mknod -m $MODE st1m c 9 65 ; chgrp $GROUP st1m
|
|
||||||
+mknod -m $MODE st1m c 9 65 ; chgrp $GROUP st1m
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 3
|
|
||||||
- # mknod -m $MODE st0a c 9 96 ; chgrp $GROUP st0a
|
|
||||||
+mknod -m $MODE st0a c 9 96 ; chgrp $GROUP st0a
|
|
||||||
# Second SCSI tape, mode 3
|
|
||||||
- # mknod -m $MODE st1a c 9 97 ; chgrp $GROUP st1a
|
|
||||||
+mknod -m $MODE st1a c 9 97 ; chgrp $GROUP st1a
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 0, no rewind
|
|
||||||
- # mknod -m $MODE nst0 c 9 128 ; chgrp $GROUP nst0
|
|
||||||
+mknod -m $MODE nst0 c 9 128 ; chgrp $GROUP nst0
|
|
||||||
# Second SCSI tape, mode 0, no rewind
|
|
||||||
- # mknod -m $MODE nst1 c 9 129 ; chgrp $GROUP nst1
|
|
||||||
+mknod -m $MODE nst1 c 9 129 ; chgrp $GROUP nst1
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 1, no rewind
|
|
||||||
- # mknod -m $MODE nst0l c 9 160 ; chgrp $GROUP nst0l
|
|
||||||
+mknod -m $MODE nst0l c 9 160 ; chgrp $GROUP nst0l
|
|
||||||
# Second SCSI tape, mode 1, no rewind
|
|
||||||
- # mknod -m $MODE nst1l c 9 161 ; chgrp $GROUP nst1l
|
|
||||||
+mknod -m $MODE nst1l c 9 161 ; chgrp $GROUP nst1l
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 2, no rewind
|
|
||||||
- # mknod -m $MODE nst0m c 9 192 ; chgrp $GROUP nst0m
|
|
||||||
+mknod -m $MODE nst0m c 9 192 ; chgrp $GROUP nst0m
|
|
||||||
# Second SCSI tape, mode 2, no rewind
|
|
||||||
- # mknod -m $MODE nst1m c 9 193 ; chgrp $GROUP nst1m
|
|
||||||
+mknod -m $MODE nst1m c 9 193 ; chgrp $GROUP nst1m
|
|
||||||
# ...
|
|
||||||
|
|
||||||
# First SCSI tape, mode 3, no rewind
|
|
||||||
- # mknod -m $MODE nst0a c 9 224 ; chgrp $GROUP nst0a
|
|
||||||
+mknod -m $MODE nst0a c 9 224 ; chgrp $GROUP nst0a
|
|
||||||
# Second SCSI tape, mode 3, no rewind
|
|
||||||
- # mknod -m $MODE nst1a c 9 225 ; chgrp $GROUP nst1a
|
|
||||||
+mknod -m $MODE nst1a c 9 225 ; chgrp $GROUP nst1a
|
|
||||||
# ...
|
|
||||||
|
|
||||||
#****************************************************************************
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
diff -u -r1.1 -r1.3
|
|
||||||
--- nameif.c 18 Oct 2000 17:26:29 -0000 1.1
|
|
||||||
+++ nameif.c 6 Mar 2003 23:26:52 -0000 1.3
|
|
||||||
@@ -117,7 +117,8 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
struct change {
|
|
||||||
- struct change *next,**pprev;
|
|
||||||
+ struct change *next;
|
|
||||||
+ int found;
|
|
||||||
char ifname[IFNAMSIZ+1];
|
|
||||||
unsigned char mac[6];
|
|
||||||
};
|
|
||||||
@@ -139,10 +140,7 @@
|
|
||||||
ch->ifname, pos);
|
|
||||||
if (parsemac(p,ch->mac) < 0)
|
|
||||||
complain(_("cannot parse MAC `%s' at %s"), p, pos);
|
|
||||||
- if (clist)
|
|
||||||
- clist->pprev = &ch->next;
|
|
||||||
ch->next = clist;
|
|
||||||
- ch->pprev = &clist;
|
|
||||||
clist = ch;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -200,7 +198,7 @@
|
|
||||||
|
|
||||||
void usage(void)
|
|
||||||
{
|
|
||||||
- fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}"));
|
|
||||||
+ fprintf(stderr, _("usage: nameif [-c configurationfile] [-s] {ifname macaddress}\n"));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -277,21 +275,21 @@
|
|
||||||
ch = lookupmac(mac);
|
|
||||||
if (!ch)
|
|
||||||
continue;
|
|
||||||
-
|
|
||||||
- *ch->pprev = ch->next;
|
|
||||||
+
|
|
||||||
+ ch->found = 1;
|
|
||||||
if (strcmp(p, ch->ifname)) {
|
|
||||||
if (setname(p, ch->ifname) < 0)
|
|
||||||
complain(_("cannot change name of %s to %s: %s"),
|
|
||||||
p, ch->ifname, strerror(errno));
|
|
||||||
}
|
|
||||||
- free(ch);
|
|
||||||
}
|
|
||||||
fclose(ifh);
|
|
||||||
|
|
||||||
while (clist) {
|
|
||||||
struct change *ch = clist;
|
|
||||||
clist = clist->next;
|
|
||||||
- warning(_("interface '%s' not found"), ch->ifname);
|
|
||||||
+ if (!ch->found)
|
|
||||||
+ warning(_("interface '%s' not found"), ch->ifname);
|
|
||||||
free(ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
diff -Nrup net-tools-1.60.orig/lib/interface.c net-tools-1.60/lib/interface.c
|
|
||||||
--- net-tools-1.60.orig/lib/interface.c 2004-08-12 05:54:09.000000000 -0400
|
|
||||||
+++ net-tools-1.60/lib/interface.c 2004-08-12 06:03:20.000000000 -0400
|
|
||||||
@@ -203,28 +203,34 @@ out:
|
|
||||||
|
|
||||||
static char *get_name(char *name, char *p)
|
|
||||||
{
|
|
||||||
- while (isspace(*p))
|
|
||||||
- p++;
|
|
||||||
- while (*p) {
|
|
||||||
- if (isspace(*p))
|
|
||||||
- break;
|
|
||||||
- if (*p == ':') { /* could be an alias */
|
|
||||||
- char *dot = p, *dotname = name;
|
|
||||||
- *name++ = *p++;
|
|
||||||
- while (isdigit(*p))
|
|
||||||
- *name++ = *p++;
|
|
||||||
- if (*p != ':') { /* it wasn't, backup */
|
|
||||||
- p = dot;
|
|
||||||
- name = dotname;
|
|
||||||
- }
|
|
||||||
- if (*p == '\0')
|
|
||||||
- return NULL;
|
|
||||||
- p++;
|
|
||||||
- break;
|
|
||||||
+ /* Extract <name>[:<alias>] from nul-terminated p where p matches
|
|
||||||
+ <name>[:<alias>]: after leading whitespace.
|
|
||||||
+ If match is not made, set name empty and return unchanged p */
|
|
||||||
+ int namestart=0, nameend=0, aliasend;
|
|
||||||
+ while (isspace(p[namestart]))
|
|
||||||
+ namestart++;
|
|
||||||
+ nameend=namestart;
|
|
||||||
+ while (p[nameend] && p[nameend]!=':' && !isspace(p[nameend]))
|
|
||||||
+ nameend++;
|
|
||||||
+ if (p[nameend]==':') {
|
|
||||||
+ aliasend=nameend+1;
|
|
||||||
+ while (p[aliasend] && isdigit(p[aliasend]))
|
|
||||||
+ aliasend++;
|
|
||||||
+ if (p[aliasend]==':') {
|
|
||||||
+ nameend=aliasend;
|
|
||||||
+ }
|
|
||||||
+ if ((nameend-namestart)<IFNAMSIZ) {
|
|
||||||
+ memcpy(name,&p[namestart],nameend-namestart);
|
|
||||||
+ name[nameend-namestart]='\0';
|
|
||||||
+ p=&p[nameend+1];
|
|
||||||
+ } else {
|
|
||||||
+ /* Interface name too large */
|
|
||||||
+ name[0]='\0';
|
|
||||||
}
|
|
||||||
- *name++ = *p++;
|
|
||||||
+ } else {
|
|
||||||
+ /* first ':' not found - return empty */
|
|
||||||
+ name[0]='\0';
|
|
||||||
}
|
|
||||||
- *name++ = '\0';
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
diff -u -r ntp-4.2.0/config.h.in ntp-4.2.0-linux-droproot/config.h.in
|
|
||||||
--- ntp-4.2.0/config.h.in 2003-10-15 11:02:22.000000000 +0200
|
|
||||||
+++ ntp-4.2.0-linux-droproot/config.h.in 2003-12-02 10:30:34.000000000 +0100
|
|
||||||
@@ -300,9 +300,12 @@
|
|
||||||
/* Do we have the CIOGETEV ioctl (SunOS, Linux)? */
|
|
||||||
#undef HAVE_CIOGETEV
|
|
||||||
|
|
||||||
-/* [Use], [/dev/clockctl?] */
|
|
||||||
+/* Do we have non-root clock control (via Linux capabilities or NetBSD /dev/clockctl)? */
|
|
||||||
#undef HAVE_CLOCKCTL
|
|
||||||
|
|
||||||
+/* Do we get clock access via Linux capabilities? */
|
|
||||||
+#undef HAVE_LINUX_CAPABILITIES
|
|
||||||
+
|
|
||||||
/* Define to 1 if you have the `clock_gettime' function. */
|
|
||||||
#undef HAVE_CLOCK_GETTIME
|
|
||||||
|
|
||||||
diff -u -r ntp-4.2.0/configure.in ntp-4.2.0-linux-droproot/configure.in
|
|
||||||
--- ntp-4.2.0/configure.in 2003-10-15 10:52:44.000000000 +0200
|
|
||||||
+++ ntp-4.2.0-linux-droproot/configure.in 2003-12-01 09:53:21.000000000 +0100
|
|
||||||
@@ -48,7 +48,7 @@
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(if we should use /dev/clockctl, ac_clockctl,
|
|
||||||
[AC_ARG_ENABLE(clockctl,
|
|
||||||
- AC_HELP_STRING([--enable-clockctl], [Use /dev/clockctl for non-root time control]),
|
|
||||||
+ AC_HELP_STRING([--enable-clockctl], [Use NetBSD /dev/clockctl for non-root clock control]),
|
|
||||||
[ans=$enableval],
|
|
||||||
[case "$target" in
|
|
||||||
*-*-netbsd*)
|
|
||||||
@@ -63,10 +63,27 @@
|
|
||||||
AC_CHECK_HEADERS(sys/clockctl.h)
|
|
||||||
case "$ac_clockctl$ac_cv_header_sys_clockctl_h" in
|
|
||||||
yesyes)
|
|
||||||
- AC_DEFINE(HAVE_CLOCKCTL, ,[[Use /dev/clockctl?]])
|
|
||||||
+ AC_DEFINE(HAVE_CLOCKCTL, ,[Non-root clock control allowed via NetBSD /dev/clockctl?])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
+AC_CACHE_CHECK(if we have linux capabilities (libcap), ac_linuxcaps,
|
|
||||||
+[AC_ARG_ENABLE(linuxcaps,
|
|
||||||
+ AC_HELP_STRING([--enable-linuxcaps], [Use Linux capabilities for non-root clock control]),
|
|
||||||
+ [ans=$enableval],
|
|
||||||
+ [ans=no])
|
|
||||||
+ac_linuxcaps=$ans])
|
|
||||||
+# End of AC_CACHE_CHECK for linuxcaps
|
|
||||||
+AC_CHECK_HEADERS(sys/capability.h)
|
|
||||||
+case "$ac_linuxcaps$ac_cv_header_sys_capability_h" in
|
|
||||||
+ yesyes)
|
|
||||||
+ AC_DEFINE(HAVE_LINUX_CAPABILITIES, ,[Do we have Linux capabilities?])
|
|
||||||
+ AC_DEFINE(HAVE_CLOCKCTL, ,[Non-root clock control allowed via Linux capabilities?])
|
|
||||||
+ LIBS="$LIBS -lcap"
|
|
||||||
+ ;;
|
|
||||||
+esac
|
|
||||||
+
|
|
||||||
+
|
|
||||||
case "$build" in
|
|
||||||
$host)
|
|
||||||
;;
|
|
||||||
diff -u -r ntp-4.2.0/ntpd/ntpd.c ntp-4.2.0-linux-droproot/ntpd/ntpd.c
|
|
||||||
--- ntp-4.2.0/ntpd/ntpd.c 2003-07-17 12:27:28.000000000 +0200
|
|
||||||
+++ ntp-4.2.0-linux-droproot/ntpd/ntpd.c 2003-12-02 11:11:09.000000000 +0100
|
|
||||||
@@ -108,6 +108,10 @@
|
|
||||||
# include <ctype.h>
|
|
||||||
# include <grp.h>
|
|
||||||
# include <pwd.h>
|
|
||||||
+#ifdef HAVE_LINUX_CAPABILITIES
|
|
||||||
+# include <sys/capability.h>
|
|
||||||
+# include <sys/prctl.h>
|
|
||||||
+#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -837,8 +841,18 @@
|
|
||||||
#ifdef HAVE_CLOCKCTL
|
|
||||||
/*
|
|
||||||
* Drop super-user privileges and chroot now if the OS supports
|
|
||||||
- * non root clock control (only NetBSD for now).
|
|
||||||
+ * non root clock control (only NetBSD and Linux for now).
|
|
||||||
*/
|
|
||||||
+
|
|
||||||
+#ifdef HAVE_LINUX_CAPABILITIES
|
|
||||||
+ /* set flag: keep privileges accross setuid() call (we only really need cap_sys_time): */
|
|
||||||
+ if( prctl( PR_SET_KEEPCAPS, 1L, 0L, 0L, 0L ) == -1 ) {
|
|
||||||
+ msyslog( LOG_ERR, "prctl( PR_SET_KEEPCAPS, 1L ) failed: %m" );
|
|
||||||
+ exit(-1);
|
|
||||||
+ }
|
|
||||||
+#endif /* HAVE_LINUX_CAPABILITIES */
|
|
||||||
+
|
|
||||||
+
|
|
||||||
if (user != NULL) {
|
|
||||||
if (isdigit((unsigned char)*user)) {
|
|
||||||
sw_uid = (uid_t)strtoul(user, &endp, 0);
|
|
||||||
@@ -871,9 +885,17 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- if (chrootdir && chroot(chrootdir)) {
|
|
||||||
- msyslog(LOG_ERR, "Cannot chroot to `%s': %m", chrootdir);
|
|
||||||
- exit (-1);
|
|
||||||
+
|
|
||||||
+ if( chrootdir ) {
|
|
||||||
+ /* make sure cwd is inside the jail: */
|
|
||||||
+ if( chdir(chrootdir) ) {
|
|
||||||
+ msyslog(LOG_ERR, "Cannot chdir() to `%s': %m", chrootdir);
|
|
||||||
+ exit (-1);
|
|
||||||
+ }
|
|
||||||
+ if( chroot(chrootdir) ) {
|
|
||||||
+ msyslog(LOG_ERR, "Cannot chroot() to `%s': %m", chrootdir);
|
|
||||||
+ exit (-1);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
if (group && setgid(sw_gid)) {
|
|
||||||
msyslog(LOG_ERR, "Cannot setgid() to group `%s': %m", group);
|
|
||||||
@@ -891,6 +913,25 @@
|
|
||||||
msyslog(LOG_ERR, "Cannot seteuid() to user `%s': %m", user);
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+#ifdef HAVE_LINUX_CAPABILITIES
|
|
||||||
+ {
|
|
||||||
+ /* We may be running under non-root uid now, but we still hold full root privileges!
|
|
||||||
+ * Let's get rid of most of them; we only keep cap_sys_time:
|
|
||||||
+ */
|
|
||||||
+ cap_t caps;
|
|
||||||
+ if( ! ( caps = cap_from_text( "cap_sys_time=ipe" ) ) ) {
|
|
||||||
+ msyslog( LOG_ERR, "cap_from_text() failed: %m" );
|
|
||||||
+ exit(-1);
|
|
||||||
+ }
|
|
||||||
+ if( cap_set_proc( caps ) == -1 ) {
|
|
||||||
+ msyslog( LOG_ERR, "cap_set_proc() failed to drop root privileges: %m" );
|
|
||||||
+ exit(-1);
|
|
||||||
+ }
|
|
||||||
+ cap_free( caps );
|
|
||||||
+ }
|
|
||||||
+#endif /* HAVE_LINUX_CAPABILITIES */
|
|
||||||
+
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Report that we're up to any trappers
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,166 +0,0 @@
|
|||||||
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
|
|
||||||
+
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
diff -urN linux-2.4.25/net/ipv4/netfilter/ip_nat_standalone.c linux-2.4.26/net/ipv4/netfilter/ip_nat_standalone.c
|
|
||||||
--- linux-2.4.25/net/ipv4/netfilter/ip_nat_standalone.c 2004-02-18 05:36:32.000000000 -0800
|
|
||||||
+++ linux-2.4.26/net/ipv4/netfilter/ip_nat_standalone.c 2004-04-14 06:05:41.000000000 -0700
|
|
||||||
@@ -114,7 +114,16 @@
|
|
||||||
WRITE_LOCK(&ip_nat_lock);
|
|
||||||
/* Seen it before? This can happen for loopback, retrans,
|
|
||||||
or local packets.. */
|
|
||||||
- if (!(info->initialized & (1 << maniptype))) {
|
|
||||||
+ if (!(info->initialized & (1 << maniptype))
|
|
||||||
+#ifndef CONFIG_IP_NF_NAT_LOCAL
|
|
||||||
+ /* If this session has already been confirmed we must not
|
|
||||||
+ * touch it again even if there is no mapping set up.
|
|
||||||
+ * Can only happen on local->local traffic with
|
|
||||||
+ * CONFIG_IP_NF_NAT_LOCAL disabled.
|
|
||||||
+ */
|
|
||||||
+ && !(ct->status & IPS_CONFIRMED)
|
|
||||||
+#endif
|
|
||||||
+ ) {
|
|
||||||
unsigned int ret;
|
|
||||||
|
|
||||||
if (ct->master
|
|
||||||
diff -urN linux-2.4.25/net/ipv6/netfilter/ip6_tables.c linux-2.4.26/net/ipv6/netfilter/ip6_tables.c
|
|
||||||
--- linux-2.4.25/net/ipv6/netfilter/ip6_tables.c 2004-02-18 05:36:32.000000000 -0800
|
|
||||||
+++ linux-2.4.26/net/ipv6/netfilter/ip6_tables.c 2004-04-14 06:05:41.000000000 -0700
|
|
||||||
@@ -1568,8 +1568,10 @@
|
|
||||||
u_int16_t datalen,
|
|
||||||
int *hotdrop)
|
|
||||||
{
|
|
||||||
- const struct tcphdr *tcp = hdr;
|
|
||||||
+ const struct tcphdr *tcp;
|
|
||||||
const struct ip6t_tcp *tcpinfo = matchinfo;
|
|
||||||
+ int tcpoff;
|
|
||||||
+ u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
|
||||||
|
|
||||||
/* To quote Alan:
|
|
||||||
|
|
||||||
@@ -1590,6 +1592,24 @@
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ tcpoff = (u8*)(skb->nh.ipv6h + 1) - skb->data;
|
|
||||||
+ tcpoff = ipv6_skip_exthdr(skb, tcpoff, &nexthdr, skb->len - tcpoff);
|
|
||||||
+ if (tcpoff < 0 || tcpoff > skb->len) {
|
|
||||||
+ duprintf("tcp_match: cannot skip exthdr. Dropping.\n");
|
|
||||||
+ *hotdrop = 1;
|
|
||||||
+ return 0;
|
|
||||||
+ } else if (nexthdr == IPPROTO_FRAGMENT)
|
|
||||||
+ return 0;
|
|
||||||
+ else if (nexthdr != IPPROTO_TCP ||
|
|
||||||
+ skb->len - tcpoff < sizeof(struct tcphdr)) {
|
|
||||||
+ /* cannot be occured */
|
|
||||||
+ duprintf("tcp_match: cannot get TCP header. Dropping.\n");
|
|
||||||
+ *hotdrop = 1;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ tcp = (struct tcphdr *)(skb->data + tcpoff);
|
|
||||||
+
|
|
||||||
/* FIXME: Try tcp doff >> packet len against various stacks --RR */
|
|
||||||
|
|
||||||
#define FWINVTCP(bool,invflg) ((bool) ^ !!(tcpinfo->invflags & invflg))
|
|
||||||
@@ -1640,8 +1660,10 @@
|
|
||||||
u_int16_t datalen,
|
|
||||||
int *hotdrop)
|
|
||||||
{
|
|
||||||
- const struct udphdr *udp = hdr;
|
|
||||||
+ const struct udphdr *udp;
|
|
||||||
const struct ip6t_udp *udpinfo = matchinfo;
|
|
||||||
+ int udpoff;
|
|
||||||
+ u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
|
||||||
|
|
||||||
if (offset == 0 && datalen < sizeof(struct udphdr)) {
|
|
||||||
/* We've been asked to examine this packet, and we
|
|
||||||
@@ -1651,6 +1673,23 @@
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ udpoff = (u8*)(skb->nh.ipv6h + 1) - skb->data;
|
|
||||||
+ udpoff = ipv6_skip_exthdr(skb, udpoff, &nexthdr, skb->len - udpoff);
|
|
||||||
+ if (udpoff < 0 || udpoff > skb->len) {
|
|
||||||
+ duprintf("udp_match: cannot skip exthdr. Dropping.\n");
|
|
||||||
+ *hotdrop = 1;
|
|
||||||
+ return 0;
|
|
||||||
+ } else if (nexthdr == IPPROTO_FRAGMENT)
|
|
||||||
+ return 0;
|
|
||||||
+ else if (nexthdr != IPPROTO_UDP ||
|
|
||||||
+ skb->len - udpoff < sizeof(struct udphdr)) {
|
|
||||||
+ duprintf("udp_match: cannot get UDP header. Dropping.\n");
|
|
||||||
+ *hotdrop = 1;
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ udp = (struct udphdr *)(skb->data + udpoff);
|
|
||||||
+
|
|
||||||
/* Must not be a fragment. */
|
|
||||||
return !offset
|
|
||||||
&& port_match(udpinfo->spts[0], udpinfo->spts[1],
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
--- patch-o-matic-ng-20040621/pptp-conntrack-nat/linux/net/ipv4/netfilter/Config.in.ladd_2.origin Fri Mar 5 10:30:28 2004
|
|
||||||
+++ patch-o-matic-ng-20040621/pptp-conntrack-nat/linux/net/ipv4/netfilter/Config.in.ladd_2 Thu Jan 27 00:42:50 2005
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
- bool ' NAT of local connections (READ HELP)' CONFIG_IP_NF_NAT_LOCAL
|
|
||||||
+ dep_tristate ' Full NAT' CONFIG_IP_NF_NAT $CONFIG_IP_NF_IPTABLES $CONFIG_IP_NF_CONNTRACK
|
|
||||||
if [ "$CONFIG_IP_NF_PPTP" = "m" ]; then
|
|
||||||
define_tristate CONFIG_IP_NF_NAT_PPTP m
|
|
||||||
else
|
|
||||||
@@ -1,263 +0,0 @@
|
|||||||
Patch found at http://patchwork.netfilter.org/netfilter-devel/patch.pl?id=2663
|
|
||||||
Thank to Roberto Nibali for his work
|
|
||||||
|
|
||||||
diff -Nur linux-2.4.31-orig/include/linux/netfilter_ipv4/ip_conntrack.h linux-2.4.31-pab2/include/linux/netfilter_ipv4/ip_conntrack.h
|
|
||||||
--- linux-2.4.31-orig/include/linux/netfilter_ipv4/ip_conntrack.h 2005-04-04 03:42:20 +0200
|
|
||||||
+++ linux-2.4.31-pab2/include/linux/netfilter_ipv4/ip_conntrack.h 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -249,6 +249,9 @@
|
|
||||||
/* Call me when a conntrack is destroyed. */
|
|
||||||
extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
|
|
||||||
|
|
||||||
+/* Fake conntrack entry for untracked connections */
|
|
||||||
+extern struct ip_conntrack ip_conntrack_untracked;
|
|
||||||
+
|
|
||||||
/* Returns new sk_buff, or NULL */
|
|
||||||
struct sk_buff *
|
|
||||||
ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
|
|
||||||
diff -Nur linux-2.4.31-orig/include/linux/netfilter_ipv4/ipt_conntrack.h linux-2.4.31-pab2/include/linux/netfilter_ipv4/ipt_conntrack.h
|
|
||||||
--- linux-2.4.31-orig/include/linux/netfilter_ipv4/ipt_conntrack.h 2002-11-29 00:53:15 +0100
|
|
||||||
+++ linux-2.4.31-pab2/include/linux/netfilter_ipv4/ipt_conntrack.h 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -10,6 +10,7 @@
|
|
||||||
|
|
||||||
#define IPT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1))
|
|
||||||
#define IPT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2))
|
|
||||||
+#define IPT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
|
|
||||||
|
|
||||||
/* flags, invflags: */
|
|
||||||
#define IPT_CONNTRACK_STATE 0x01
|
|
||||||
diff -Nur linux-2.4.31-orig/include/linux/netfilter_ipv4/ipt_state.h linux-2.4.31-pab2/include/linux/netfilter_ipv4/ipt_state.h
|
|
||||||
--- linux-2.4.31-orig/include/linux/netfilter_ipv4/ipt_state.h 2000-04-14 18:37:20 +0200
|
|
||||||
+++ linux-2.4.31-pab2/include/linux/netfilter_ipv4/ipt_state.h 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -3,6 +3,7 @@
|
|
||||||
|
|
||||||
#define IPT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
|
|
||||||
#define IPT_STATE_INVALID (1 << 0)
|
|
||||||
+#define IPT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
|
|
||||||
|
|
||||||
struct ipt_state_info
|
|
||||||
{
|
|
||||||
diff -Nur linux-2.4.31-orig/include/linux/netfilter_ipv4.h linux-2.4.31-pab2/include/linux/netfilter_ipv4.h
|
|
||||||
--- linux-2.4.31-orig/include/linux/netfilter_ipv4.h 2002-02-25 20:38:13 +0100
|
|
||||||
+++ linux-2.4.31-pab2/include/linux/netfilter_ipv4.h 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -51,6 +51,8 @@
|
|
||||||
|
|
||||||
enum nf_ip_hook_priorities {
|
|
||||||
NF_IP_PRI_FIRST = INT_MIN,
|
|
||||||
+ NF_IP_PRI_CONNTRACK_DEFRAG = -400,
|
|
||||||
+ NF_IP_PRI_RAW = -300,
|
|
||||||
NF_IP_PRI_CONNTRACK = -200,
|
|
||||||
NF_IP_PRI_MANGLE = -150,
|
|
||||||
NF_IP_PRI_NAT_DST = -100,
|
|
||||||
diff -Nur linux-2.4.31-orig/net/ipv4/netfilter/ip_conntrack_core.c linux-2.4.31-pab2/net/ipv4/netfilter/ip_conntrack_core.c
|
|
||||||
--- linux-2.4.31-orig/net/ipv4/netfilter/ip_conntrack_core.c 2005-04-04 03:42:20 +0200
|
|
||||||
+++ linux-2.4.31-pab2/net/ipv4/netfilter/ip_conntrack_core.c 2005-06-29 12:42:09 +0200
|
|
||||||
@@ -65,6 +65,7 @@
|
|
||||||
struct list_head *ip_conntrack_hash;
|
|
||||||
static kmem_cache_t *ip_conntrack_cachep;
|
|
||||||
static LIST_HEAD(unconfirmed);
|
|
||||||
+struct ip_conntrack ip_conntrack_untracked;
|
|
||||||
|
|
||||||
extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
|
|
||||||
|
|
||||||
@@ -823,6 +824,19 @@
|
|
||||||
int set_reply;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
+ /* Previously seen (loopback or untracked)? Ignore. */
|
|
||||||
+ if ((*pskb)->nfct)
|
|
||||||
+ return NF_ACCEPT;
|
|
||||||
+
|
|
||||||
+ /* Never happen */
|
|
||||||
+ if ((*pskb)->nh.iph->frag_off & htons(IP_OFFSET)) {
|
|
||||||
+ if (net_ratelimit()) {
|
|
||||||
+ printk(KERN_ERR "ip_conntrack_in: Frag of proto %u (hook=%u)\n",
|
|
||||||
+ (*pskb)->nh.iph->protocol, hooknum);
|
|
||||||
+ }
|
|
||||||
+ return NF_DROP;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* FIXME: Do this right please. --RR */
|
|
||||||
(*pskb)->nfcache |= NFC_UNKNOWN;
|
|
||||||
|
|
||||||
@@ -841,21 +855,6 @@
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- /* Previously seen (loopback)? Ignore. Do this before
|
|
||||||
- fragment check. */
|
|
||||||
- if ((*pskb)->nfct)
|
|
||||||
- return NF_ACCEPT;
|
|
||||||
-
|
|
||||||
- /* Gather fragments. */
|
|
||||||
- if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
|
|
||||||
- *pskb = ip_ct_gather_frags(*pskb,
|
|
||||||
- hooknum == NF_IP_PRE_ROUTING ?
|
|
||||||
- IP_DEFRAG_CONNTRACK_IN :
|
|
||||||
- IP_DEFRAG_CONNTRACK_OUT);
|
|
||||||
- if (!*pskb)
|
|
||||||
- return NF_STOLEN;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
proto = ip_ct_find_proto((*pskb)->nh.iph->protocol);
|
|
||||||
|
|
||||||
/* It may be an icmp error... */
|
|
||||||
@@ -1392,6 +1391,8 @@
|
|
||||||
schedule();
|
|
||||||
goto i_see_dead_people;
|
|
||||||
}
|
|
||||||
+ while (atomic_read(&ip_conntrack_untracked.ct_general.use) > 1)
|
|
||||||
+ schedule();
|
|
||||||
|
|
||||||
kmem_cache_destroy(ip_conntrack_cachep);
|
|
||||||
vfree(ip_conntrack_hash);
|
|
||||||
@@ -1459,6 +1460,18 @@
|
|
||||||
|
|
||||||
/* For use by ipt_REJECT */
|
|
||||||
ip_ct_attach = ip_conntrack_attach;
|
|
||||||
+
|
|
||||||
+ /* Set up fake conntrack:
|
|
||||||
+ - never to be deleted, not in any hashes */
|
|
||||||
+ atomic_set(&ip_conntrack_untracked.ct_general.use, 1);
|
|
||||||
+ /* - and let it look as if it's a confirmed connection */
|
|
||||||
+ set_bit(IPS_CONFIRMED_BIT, &ip_conntrack_untracked.status);
|
|
||||||
+ /* - and prepare the ctinfo field for REJECT/NAT. */
|
|
||||||
+ ip_conntrack_untracked.infos[IP_CT_NEW].master =
|
|
||||||
+ ip_conntrack_untracked.infos[IP_CT_RELATED].master =
|
|
||||||
+ ip_conntrack_untracked.infos[IP_CT_RELATED + IP_CT_IS_REPLY].master =
|
|
||||||
+ &ip_conntrack_untracked.ct_general;
|
|
||||||
+
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
err_free_hash:
|
|
||||||
diff -Nur linux-2.4.31-orig/net/ipv4/netfilter/ip_conntrack_standalone.c linux-2.4.31-pab2/net/ipv4/netfilter/ip_conntrack_standalone.c
|
|
||||||
--- linux-2.4.31-orig/net/ipv4/netfilter/ip_conntrack_standalone.c 2005-04-04 03:42:20 +0200
|
|
||||||
+++ linux-2.4.31-pab2/net/ipv4/netfilter/ip_conntrack_standalone.c 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -189,6 +189,29 @@
|
|
||||||
return ip_conntrack_confirm(*pskb);
|
|
||||||
}
|
|
||||||
|
|
||||||
+static unsigned int ip_conntrack_defrag(unsigned int hooknum,
|
|
||||||
+ struct sk_buff **pskb,
|
|
||||||
+ const struct net_device *in,
|
|
||||||
+ const struct net_device *out,
|
|
||||||
+ int (*okfn)(struct sk_buff *))
|
|
||||||
+{
|
|
||||||
+ /* Previously seen (loopback)? Ignore. Do this before
|
|
||||||
+ * fragment check. */
|
|
||||||
+ if ((*pskb)->nfct)
|
|
||||||
+ return NF_ACCEPT;
|
|
||||||
+
|
|
||||||
+ /* Gather fragments. */
|
|
||||||
+ if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) {
|
|
||||||
+ *pskb = ip_ct_gather_frags(*pskb,
|
|
||||||
+ hooknum == NF_IP_PRE_ROUTING ?
|
|
||||||
+ IP_DEFRAG_CONNTRACK_IN :
|
|
||||||
+ IP_DEFRAG_CONNTRACK_OUT);
|
|
||||||
+ if (!*pskb)
|
|
||||||
+ return NF_STOLEN;
|
|
||||||
+ }
|
|
||||||
+ return NF_ACCEPT;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static unsigned int ip_refrag(unsigned int hooknum,
|
|
||||||
struct sk_buff **pskb,
|
|
||||||
const struct net_device *in,
|
|
||||||
@@ -230,9 +253,15 @@
|
|
||||||
|
|
||||||
/* Connection tracking may drop packets, but never alters them, so
|
|
||||||
make it the first hook. */
|
|
||||||
+static struct nf_hook_ops ip_conntrack_defrag_ops
|
|
||||||
+= { { NULL, NULL }, ip_conntrack_defrag, PF_INET, NF_IP_PRE_ROUTING,
|
|
||||||
+ NF_IP_PRI_CONNTRACK_DEFRAG };
|
|
||||||
static struct nf_hook_ops ip_conntrack_in_ops
|
|
||||||
= { { NULL, NULL }, ip_conntrack_in, PF_INET, NF_IP_PRE_ROUTING,
|
|
||||||
NF_IP_PRI_CONNTRACK };
|
|
||||||
+static struct nf_hook_ops ip_conntrack_defrag_local_out_ops
|
|
||||||
+= { { NULL, NULL }, ip_conntrack_defrag, PF_INET, NF_IP_LOCAL_OUT,
|
|
||||||
+ NF_IP_PRI_CONNTRACK_DEFRAG };
|
|
||||||
static struct nf_hook_ops ip_conntrack_local_out_ops
|
|
||||||
= { { NULL, NULL }, ip_conntrack_local, PF_INET, NF_IP_LOCAL_OUT,
|
|
||||||
NF_IP_PRI_CONNTRACK };
|
|
||||||
@@ -353,10 +382,21 @@
|
|
||||||
if (!proc) goto cleanup_init;
|
|
||||||
proc->owner = THIS_MODULE;
|
|
||||||
|
|
||||||
+ ret = nf_register_hook(&ip_conntrack_defrag_ops);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ printk("ip_conntrack: can't register pre-routing defrag hook.\n");
|
|
||||||
+ goto cleanup_proc;
|
|
||||||
+ }
|
|
||||||
+ ret = nf_register_hook(&ip_conntrack_defrag_local_out_ops);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ printk("ip_conntrack: can't register local_out defrag hook.\n");
|
|
||||||
+ goto cleanup_defragops;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
ret = nf_register_hook(&ip_conntrack_in_ops);
|
|
||||||
if (ret < 0) {
|
|
||||||
printk("ip_conntrack: can't register pre-routing hook.\n");
|
|
||||||
- goto cleanup_proc;
|
|
||||||
+ goto cleanup_defraglocalops;
|
|
||||||
}
|
|
||||||
ret = nf_register_hook(&ip_conntrack_local_out_ops);
|
|
||||||
if (ret < 0) {
|
|
||||||
@@ -394,6 +434,10 @@
|
|
||||||
nf_unregister_hook(&ip_conntrack_local_out_ops);
|
|
||||||
cleanup_inops:
|
|
||||||
nf_unregister_hook(&ip_conntrack_in_ops);
|
|
||||||
+ cleanup_defraglocalops:
|
|
||||||
+ nf_unregister_hook(&ip_conntrack_defrag_local_out_ops);
|
|
||||||
+ cleanup_defragops:
|
|
||||||
+ nf_unregister_hook(&ip_conntrack_defrag_ops);
|
|
||||||
cleanup_proc:
|
|
||||||
proc_net_remove("ip_conntrack");
|
|
||||||
cleanup_init:
|
|
||||||
@@ -483,5 +527,6 @@
|
|
||||||
EXPORT_SYMBOL(ip_conntrack_expect_list);
|
|
||||||
EXPORT_SYMBOL(ip_conntrack_lock);
|
|
||||||
EXPORT_SYMBOL(ip_conntrack_hash);
|
|
||||||
+EXPORT_SYMBOL(ip_conntrack_untracked);
|
|
||||||
EXPORT_SYMBOL_GPL(ip_conntrack_find_get);
|
|
||||||
EXPORT_SYMBOL_GPL(ip_conntrack_put);
|
|
||||||
diff -Nur linux-2.4.31-orig/net/ipv4/netfilter/ip_nat_core.c linux-2.4.31-pab2/net/ipv4/netfilter/ip_nat_core.c
|
|
||||||
--- linux-2.4.31-orig/net/ipv4/netfilter/ip_nat_core.c 2005-04-04 03:42:20 +0200
|
|
||||||
+++ linux-2.4.31-pab2/net/ipv4/netfilter/ip_nat_core.c 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -1024,6 +1024,10 @@
|
|
||||||
IP_NF_ASSERT(ip_conntrack_destroyed == NULL);
|
|
||||||
ip_conntrack_destroyed = &ip_nat_cleanup_conntrack;
|
|
||||||
|
|
||||||
+ /* Initialize fake conntrack so that NAT will skip it */
|
|
||||||
+ ip_conntrack_untracked.nat.info.initialized |=
|
|
||||||
+ (1 << IP_NAT_MANIP_SRC) | (1 << IP_NAT_MANIP_DST);
|
|
||||||
+
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -Nur linux-2.4.31-orig/net/ipv4/netfilter/ipt_conntrack.c linux-2.4.31-pab2/net/ipv4/netfilter/ipt_conntrack.c
|
|
||||||
--- linux-2.4.31-orig/net/ipv4/netfilter/ipt_conntrack.c 2004-02-18 14:36:32 +0100
|
|
||||||
+++ linux-2.4.31-pab2/net/ipv4/netfilter/ipt_conntrack.c 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -27,7 +27,9 @@
|
|
||||||
|
|
||||||
#define FWINV(bool,invflg) ((bool) ^ !!(sinfo->invflags & invflg))
|
|
||||||
|
|
||||||
- if (ct)
|
|
||||||
+ if (skb->nfct == &ip_conntrack_untracked.infos[IP_CT_NEW])
|
|
||||||
+ statebit = IPT_CONNTRACK_STATE_UNTRACKED;
|
|
||||||
+ else if (ct)
|
|
||||||
statebit = IPT_CONNTRACK_STATE_BIT(ctinfo);
|
|
||||||
else
|
|
||||||
statebit = IPT_CONNTRACK_STATE_INVALID;
|
|
||||||
diff -Nur linux-2.4.31-orig/net/ipv4/netfilter/ipt_state.c linux-2.4.31-pab2/net/ipv4/netfilter/ipt_state.c
|
|
||||||
--- linux-2.4.31-orig/net/ipv4/netfilter/ipt_state.c 2004-02-18 14:36:32 +0100
|
|
||||||
+++ linux-2.4.31-pab2/net/ipv4/netfilter/ipt_state.c 2005-06-29 12:23:37 +0200
|
|
||||||
@@ -21,7 +21,9 @@
|
|
||||||
enum ip_conntrack_info ctinfo;
|
|
||||||
unsigned int statebit;
|
|
||||||
|
|
||||||
- if (!ip_conntrack_get((struct sk_buff *)skb, &ctinfo))
|
|
||||||
+ if (skb->nfct == &ip_conntrack_untracked.infos[IP_CT_NEW])
|
|
||||||
+ statebit = IPT_STATE_UNTRACKED;
|
|
||||||
+ else if (!ip_conntrack_get((struct sk_buff *)skb, &ctinfo))
|
|
||||||
statebit = IPT_STATE_INVALID;
|
|
||||||
else
|
|
||||||
statebit = IPT_STATE_BIT(ctinfo);
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
--- pcre-4.5/pcre.c.tn 2003-12-10 17:45:44.000000000 +0100
|
|
||||||
+++ pcre-4.5/pcre.c 2005-08-19 15:11:17.000000000 +0200
|
|
||||||
@@ -1047,7 +1047,18 @@
|
|
||||||
int min = 0;
|
|
||||||
int max = -1;
|
|
||||||
|
|
||||||
+/* Read the minimum value and do a paranoid check: a negative value indicates
|
|
||||||
+an integer overflow. */
|
|
||||||
+
|
|
||||||
while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
|
|
||||||
+if (min < 0 || min > 65535)
|
|
||||||
+ {
|
|
||||||
+ *errorptr = ERR5;
|
|
||||||
+ return p;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+/* Read the maximum value if there is one, and again do a paranoid on its size.
|
|
||||||
+Also, max must not be less than min. */
|
|
||||||
|
|
||||||
if (*p == '}') max = min; else
|
|
||||||
{
|
|
||||||
@@ -1055,6 +1066,11 @@
|
|
||||||
{
|
|
||||||
max = 0;
|
|
||||||
while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
|
|
||||||
+ if (max < 0 || max > 65535)
|
|
||||||
+ {
|
|
||||||
+ *errorptr = ERR5;
|
|
||||||
+ return p;
|
|
||||||
+ }
|
|
||||||
if (max < min)
|
|
||||||
{
|
|
||||||
*errorptr = ERR4;
|
|
||||||
@@ -1063,16 +1079,11 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-/* Do paranoid checks, then fill in the required variables, and pass back the
|
|
||||||
-pointer to the terminating '}'. */
|
|
||||||
+/* Fill in the required variables, and pass back the pointer to the terminating
|
|
||||||
+'}'. */
|
|
||||||
|
|
||||||
-if (min > 65535 || max > 65535)
|
|
||||||
- *errorptr = ERR5;
|
|
||||||
-else
|
|
||||||
- {
|
|
||||||
- *minp = min;
|
|
||||||
- *maxp = max;
|
|
||||||
- }
|
|
||||||
+*minp = min;
|
|
||||||
+*maxp = max;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
diff -uwr perl-5.8.5/perlio.c perl-5.8.5-patched/perlio.c
|
|
||||||
--- perl-5.8.5/perlio.c 2004-03-16 18:36:08.000000000 +0000
|
|
||||||
+++ perl-5.8.5-patched/perlio.c 2005-02-05 13:24:58.764830408 +0000
|
|
||||||
@@ -448,7 +448,7 @@
|
|
||||||
va_list ap;
|
|
||||||
dSYS;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
- if (!dbg) {
|
|
||||||
+ if (!dbg && !PL_tainting && PL_uid == PL_euid && PL_gid == PL_egid) {
|
|
||||||
char *s = PerlEnv_getenv("PERLIO_DEBUG");
|
|
||||||
if (s && *s)
|
|
||||||
dbg = PerlLIO_open3(s, O_WRONLY | O_CREAT | O_APPEND, 0666);
|
|
||||||
@@ -465,7 +465,7 @@
|
|
||||||
s = CopFILE(PL_curcop);
|
|
||||||
if (!s)
|
|
||||||
s = "(none)";
|
|
||||||
- sprintf(buffer, "%s:%" IVdf " ", s, (IV) CopLINE(PL_curcop));
|
|
||||||
+ sprintf(buffer, "%.40s:%" IVdf " ", s, (IV) CopLINE(PL_curcop));
|
|
||||||
len = strlen(buffer);
|
|
||||||
vsprintf(buffer+len, fmt, ap);
|
|
||||||
PerlLIO_write(dbg, buffer, strlen(buffer));
|
|
||||||
Only in perl-5.8.5-patched: perlio.c.orig
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
diff -ur perl-5.8.5.orig/lib/ExtUtils/instmodsh perl-5.8.5/lib/ExtUtils/instmodsh
|
|
||||||
--- perl-5.8.5.orig/lib/ExtUtils/instmodsh Tue Sep 30 17:10:47 2003
|
|
||||||
+++ perl-5.8.5/lib/ExtUtils/instmodsh Mon Jan 19 20:14:11 2004
|
|
||||||
@@ -2,6 +2,7 @@
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
|
||||||
+use File::Temp;
|
|
||||||
use ExtUtils::Packlist;
|
|
||||||
use ExtUtils::Installed;
|
|
||||||
|
|
||||||
@@ -58,16 +59,12 @@
|
|
||||||
$reply =~ /^t\s*/ and do
|
|
||||||
{
|
|
||||||
my $file = (split(' ', $reply))[1];
|
|
||||||
- my $tmp = "/tmp/inst.$$";
|
|
||||||
- if (my $fh = IO::File->new($tmp, "w"))
|
|
||||||
- {
|
|
||||||
- $fh->print(join("\n", $Inst->files($module)));
|
|
||||||
- $fh->close();
|
|
||||||
- system("tar cvf $file -I $tmp");
|
|
||||||
- unlink($tmp);
|
|
||||||
- last CASE;
|
|
||||||
- }
|
|
||||||
- else { print("Can't open $file: $!\n"); }
|
|
||||||
+ my ($fh, $tmp) = File::Temp::tempfile(UNLINK => 1);
|
|
||||||
+ $fh->print(join("\n", $Inst->files($module)));
|
|
||||||
+ $fh->close();
|
|
||||||
+ # This used to use -I which is wrong for GNU tar.
|
|
||||||
+ system("tar cvf $file -T $tmp");
|
|
||||||
+ unlink($tmp);
|
|
||||||
last CASE;
|
|
||||||
};
|
|
||||||
$reply eq 'v' and do
|
|
||||||
|
|
||||||
diff -ur perl-5.8.5.orig/lib/perl5db.pl perl-5.8.5/lib/perl5db.pl
|
|
||||||
--- perl-5.8.5.orig/lib/perl5db.pl Mon Jan 19 18:46:25 2004
|
|
||||||
+++ perl-5.8.5/lib/perl5db.pl Mon Jan 19 20:14:11 2004
|
|
||||||
@@ -206,7 +206,7 @@
|
|
||||||
=item * noTTY
|
|
||||||
|
|
||||||
if set, goes in NonStop mode. On interrupt, if TTY is not set,
|
|
||||||
-uses the value of noTTY or "/tmp/perldbtty$$" to find TTY using
|
|
||||||
+uses the value of noTTY or "/var/run/perldbtty$$" to find TTY using
|
|
||||||
Term::Rendezvous. Current variant is to have the name of TTY in this
|
|
||||||
file.
|
|
||||||
|
|
||||||
@@ -5689,8 +5689,8 @@
|
|
||||||
else {
|
|
||||||
eval "require Term::Rendezvous;" or die;
|
|
||||||
# See if we have anything to pass to Term::Rendezvous.
|
|
||||||
- # Use /tmp/perldbtty$$ if not.
|
|
||||||
- my $rv = $ENV{PERLDB_NOTTY} || "/tmp/perldbtty$$";
|
|
||||||
+ # Use /var/run/perldbtty$$ if not.
|
|
||||||
+ my $rv = $ENV{PERLDB_NOTTY} || "/var/run/perldbtty$$";
|
|
||||||
|
|
||||||
# Rendezvous and get the filehandles.
|
|
||||||
my $term_rv = new Term::Rendezvous $rv;
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
--- perl-5.8.4/lib/CGI.pm.old 2004-03-11 20:55:39.000000000 +0000
|
|
||||||
+++ perl-5.8.4/lib/CGI.pm 2003-09-30 18:10:42.000000000 +0100
|
|
||||||
@@ -328,20 +328,9 @@
|
|
||||||
return $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
-# We provide a DESTROY method so that we can ensure that
|
|
||||||
-# temporary files are closed (via Fh->DESTROY) before they
|
|
||||||
-# are unlinked (via CGITempFile->DESTROY) because it is not
|
|
||||||
-# possible to unlink an open file on Win32. We explicitly
|
|
||||||
-# call DESTROY on each, rather than just undefing them and
|
|
||||||
-# letting Perl DESTROY them by garbage collection, in case the
|
|
||||||
-# user is still holding any reference to them as well.
|
|
||||||
-sub DESTROY {
|
|
||||||
- my $self = shift;
|
|
||||||
- foreach my $href (values %{$self->{'.tmpfiles'}}) {
|
|
||||||
- $href->{hndl}->DESTROY if defined $href->{hndl};
|
|
||||||
- $href->{name}->DESTROY if defined $href->{name};
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
+# We provide a DESTROY method so that the autoloader
|
|
||||||
+# doesn't bother trying to find it.
|
|
||||||
+sub DESTROY { }
|
|
||||||
|
|
||||||
sub r {
|
|
||||||
my $self = shift;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- linux-2.4.patch.old 2004-08-11 19:57:22.498678130 +0100
|
|
||||||
+++ linux-2.4.patch 2004-08-11 19:57:36.474241273 +0100
|
|
||||||
@@ -402,7 +402,7 @@
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* if threshold is reached, send message to userspace */
|
|
||||||
-+ if (qlen >= loginfo.qthreshold) {
|
|
||||||
++ if (ub->qlen >= loginfo.qthreshold) {
|
|
||||||
+ if (loginfo.qthreshold > 1)
|
|
||||||
+ nlh->nlmsg_type = NLMSG_DONE;
|
|
||||||
+ }
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- src/old.modem_run.c Wed Mar 17 22:52:46 2004
|
|
||||||
+++ src/modem_run.c Wed Sep 29 14:11:10 2004
|
|
||||||
@@ -268,7 +268,7 @@
|
|
||||||
} else {
|
|
||||||
report(1, REPORT_INFO, "Modem revision: %04x\n", revision);
|
|
||||||
switch(revision) {
|
|
||||||
- case 0x0000:
|
|
||||||
+ case 0x0000: case 0x000a:
|
|
||||||
revision = 0;
|
|
||||||
break;
|
|
||||||
case 0x0200:
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
diff -ur sysklogd-1.3-31.orig/klogd.c sysklogd-1.3-31/klogd.c
|
|
||||||
--- sysklogd-1.3-31.orig/klogd.c Tue Jan 19 03:09:12 1999
|
|
||||||
+++ sysklogd-1.3-31/klogd.c Tue Sep 12 20:08:57 2000
|
|
||||||
@@ -856,7 +856,7 @@
|
|
||||||
* messages into this fresh buffer.
|
|
||||||
*/
|
|
||||||
memset(log_buffer, '\0', sizeof(log_buffer));
|
|
||||||
- if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer))) < 0 )
|
|
||||||
+ if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer)-1)) < 0 )
|
|
||||||
{
|
|
||||||
if ( errno == EINTR )
|
|
||||||
return;
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
diff -ur sysklogd-1.4.1.orig/klogd.8 sysklogd-1.4.1/klogd.8
|
|
||||||
--- sysklogd-1.4.1.orig/klogd.8 Sun Mar 11 22:35:51 2001
|
|
||||||
+++ sysklogd-1.4.1/klogd.8 Mon Oct 8 09:50:50 2001
|
|
||||||
@@ -3,8 +3,9 @@
|
|
||||||
.\" Sun Jul 30 01:35:55 MET: Martin Schulze: Updates
|
|
||||||
.\" Sun Nov 19 23:22:21 MET: Martin Schulze: Updates
|
|
||||||
.\" Mon Aug 19 09:42:08 CDT 1996: Dr. G.W. Wettstein: Updates
|
|
||||||
+.\" Thu Feb 17 2000: Chris Wing: Unprivileged klogd feature
|
|
||||||
.\"
|
|
||||||
-.TH KLOGD 8 "21 August, 1999" "Version 1.4" "Linux System Administration"
|
|
||||||
+.TH KLOGD 8 "8 October, 2001" "Version 1.4.1+CAEN/OW" "Linux System Administration"
|
|
||||||
.SH NAME
|
|
||||||
klogd \- Kernel Log Daemon
|
|
||||||
.LP
|
|
||||||
@@ -17,6 +18,12 @@
|
|
||||||
.RB [ " \-f "
|
|
||||||
.I fname
|
|
||||||
]
|
|
||||||
+.RB [ " \-u "
|
|
||||||
+.I username
|
|
||||||
+]
|
|
||||||
+.RB [ " \-j "
|
|
||||||
+.I chroot_dir
|
|
||||||
+]
|
|
||||||
.RB [ " \-iI " ]
|
|
||||||
.RB [ " \-n " ]
|
|
||||||
.RB [ " \-o " ]
|
|
||||||
@@ -45,6 +52,20 @@
|
|
||||||
.TP
|
|
||||||
.BI "\-f " file
|
|
||||||
Log messages to the specified filename rather than to the syslog facility.
|
|
||||||
+.TP
|
|
||||||
+.BI "\-u " username
|
|
||||||
+Tells klogd to become the specified user and drop root privileges before
|
|
||||||
+starting logging.
|
|
||||||
+.TP
|
|
||||||
+.BI "\-j " chroot_dir
|
|
||||||
+Tells klogd to
|
|
||||||
+.BR chroot (2)
|
|
||||||
+into this directory after initializing.
|
|
||||||
+This option is only valid if the \-u option is also used to run klogd
|
|
||||||
+without root privileges.
|
|
||||||
+Note that the use of this option will prevent \-i and \-I from working
|
|
||||||
+unless you set up the chroot directory in such a way that klogd can still
|
|
||||||
+read the kernel module symbols.
|
|
||||||
.TP
|
|
||||||
.BI "\-i \-I"
|
|
||||||
Signal the currently executing klogd daemon. Both of these switches control
|
|
||||||
diff -ur sysklogd-1.4.1.orig/klogd.c sysklogd-1.4.1/klogd.c
|
|
||||||
--- sysklogd-1.4.1.orig/klogd.c Sun Mar 11 22:40:10 2001
|
|
||||||
+++ sysklogd-1.4.1/klogd.c Mon Oct 8 09:52:06 2001
|
|
||||||
@@ -258,6 +258,8 @@
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <paths.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
+#include <pwd.h>
|
|
||||||
+#include <grp.h>
|
|
||||||
#include "klogd.h"
|
|
||||||
#include "ksyms.h"
|
|
||||||
#ifndef TESTING
|
|
||||||
@@ -308,6 +310,9 @@
|
|
||||||
int debugging = 0;
|
|
||||||
int symbols_twice = 0;
|
|
||||||
|
|
||||||
+char *server_user = NULL;
|
|
||||||
+char *chroot_dir = NULL;
|
|
||||||
+int log_flags = 0;
|
|
||||||
|
|
||||||
/* Function prototypes. */
|
|
||||||
extern int ksyslog(int type, char *buf, int len);
|
|
||||||
@@ -528,8 +533,9 @@
|
|
||||||
* First do a stat to determine whether or not the proc based
|
|
||||||
* file system is available to get kernel messages from.
|
|
||||||
*/
|
|
||||||
- if ( use_syscall ||
|
|
||||||
- ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT)) )
|
|
||||||
+ if (!server_user &&
|
|
||||||
+ (use_syscall ||
|
|
||||||
+ ((stat(_PATH_KLOG, &sb) < 0) && (errno == ENOENT))))
|
|
||||||
{
|
|
||||||
/* Initialize kernel logging. */
|
|
||||||
ksyslog(1, NULL, 0);
|
|
||||||
@@ -977,6 +983,27 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+static int drop_root(void)
|
|
||||||
+{
|
|
||||||
+ struct passwd *pw;
|
|
||||||
+
|
|
||||||
+ if (!(pw = getpwnam(server_user))) return -1;
|
|
||||||
+
|
|
||||||
+ if (!pw->pw_uid) return -1;
|
|
||||||
+
|
|
||||||
+ if (chroot_dir) {
|
|
||||||
+ if (chroot(chroot_dir)) return -1;
|
|
||||||
+ if (chdir("/")) return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (setgroups(0, NULL)) return -1;
|
|
||||||
+ if (setgid(pw->pw_gid)) return -1;
|
|
||||||
+ if (setuid(pw->pw_uid)) return -1;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
int main(argc, argv)
|
|
||||||
|
|
||||||
int argc;
|
|
||||||
@@ -994,7 +1021,7 @@
|
|
||||||
chdir ("/");
|
|
||||||
#endif
|
|
||||||
/* Parse the command-line. */
|
|
||||||
- while ((ch = getopt(argc, argv, "c:df:iIk:nopsvx2")) != EOF)
|
|
||||||
+ while ((ch = getopt(argc, argv, "c:df:u:j:iIk:nopsvx2")) != EOF)
|
|
||||||
switch((char)ch)
|
|
||||||
{
|
|
||||||
case '2': /* Print lines with symbols twice. */
|
|
||||||
@@ -1016,6 +1043,10 @@
|
|
||||||
case 'I':
|
|
||||||
SignalDaemon(SIGUSR2);
|
|
||||||
return(0);
|
|
||||||
+ case 'j': /* chroot 'j'ail */
|
|
||||||
+ chroot_dir = optarg;
|
|
||||||
+ log_flags |= LOG_NDELAY;
|
|
||||||
+ break;
|
|
||||||
case 'k': /* Kernel symbol file. */
|
|
||||||
symfile = optarg;
|
|
||||||
break;
|
|
||||||
@@ -1031,6 +1062,9 @@
|
|
||||||
case 's': /* Use syscall interface. */
|
|
||||||
use_syscall = 1;
|
|
||||||
break;
|
|
||||||
+ case 'u': /* Run as this user */
|
|
||||||
+ server_user = optarg;
|
|
||||||
+ break;
|
|
||||||
case 'v':
|
|
||||||
printf("klogd %s.%s\n", VERSION, PATCHLEVEL);
|
|
||||||
exit (1);
|
|
||||||
@@ -1039,6 +1073,10 @@
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (chroot_dir && !server_user) {
|
|
||||||
+ fputs("'-j' is only valid with '-u'", stderr);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* Set console logging level. */
|
|
||||||
if ( log_level != (char *) 0 )
|
|
||||||
@@ -1136,7 +1174,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
- openlog("kernel", 0, LOG_KERN);
|
|
||||||
+ openlog("kernel", log_flags, LOG_KERN);
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle one-shot logging. */
|
|
||||||
@@ -1161,4 +1199,9 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (server_user && drop_root()) {
|
|
||||||
+ syslog(LOG_ALERT, "klogd: failed to drop root");
|
|
||||||
+ Terminate();
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* The main loop. */
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
diff -ur sysklogd-1.4.1.orig/sysklogd.8 sysklogd-1.4.1/sysklogd.8
|
|
||||||
--- sysklogd-1.4.1.orig/sysklogd.8 Sun Mar 11 22:35:51 2001
|
|
||||||
+++ sysklogd-1.4.1/sysklogd.8 Mon Oct 8 07:20:31 2001
|
|
||||||
@@ -2,7 +2,7 @@
|
|
||||||
.\" May be distributed under the GNU General Public License
|
|
||||||
.\" Sun Aug 30 11:35:55 MET: Martin Schulze: Updates
|
|
||||||
.\"
|
|
||||||
-.TH SYSKLOGD 8 "12 October 1998" "Version 1.3" "Linux System Administration"
|
|
||||||
+.TH SYSKLOGD 8 "8 October, 2001" "Version 1.4.1+CAEN/OW" "Linux System Administration"
|
|
||||||
.SH NAME
|
|
||||||
sysklogd \- Linux system logging utilities.
|
|
||||||
.SH SYNOPSIS
|
|
||||||
@@ -15,6 +15,9 @@
|
|
||||||
.I config file
|
|
||||||
]
|
|
||||||
.RB [ " \-h " ]
|
|
||||||
+.RB [ " \-i "
|
|
||||||
+.I IP address
|
|
||||||
+]
|
|
||||||
.RB [ " \-l "
|
|
||||||
.I hostlist
|
|
||||||
]
|
|
||||||
@@ -103,6 +106,13 @@
|
|
||||||
Specifying this switch on the command line will cause the log daemon to
|
|
||||||
forward any remote messages it receives to forwarding hosts which have been
|
|
||||||
defined.
|
|
||||||
+.TP
|
|
||||||
+.BI "\-i " "IP address"
|
|
||||||
+If
|
|
||||||
+.B syslogd
|
|
||||||
+is configured to accept log input from a UDP port, specify an IP address
|
|
||||||
+to bind to, rather than the default of INADDR_ANY. The address must be in
|
|
||||||
+dotted quad notation, DNS host names are not allowed.
|
|
||||||
.TP
|
|
||||||
.BI "\-l " "hostlist"
|
|
||||||
Specify a hostname that should be logged only with its simple hostname
|
|
||||||
diff -ur sysklogd-1.4.1.orig/syslogd.c sysklogd-1.4.1/syslogd.c
|
|
||||||
--- sysklogd-1.4.1.orig/syslogd.c Sun Mar 11 22:40:10 2001
|
|
||||||
+++ sysklogd-1.4.1/syslogd.c Mon Oct 8 07:24:41 2001
|
|
||||||
@@ -736,6 +736,8 @@
|
|
||||||
int NoHops = 1; /* Can we bounce syslog messages through an
|
|
||||||
intermediate host. */
|
|
||||||
|
|
||||||
+char *bind_addr = NULL; /* bind UDP port to this interface only */
|
|
||||||
+
|
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
/* Function prototypes. */
|
|
||||||
@@ -829,7 +831,7 @@
|
|
||||||
funix[i] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- while ((ch = getopt(argc, argv, "a:dhf:l:m:np:rs:v")) != EOF)
|
|
||||||
+ while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF)
|
|
||||||
switch((char)ch) {
|
|
||||||
case 'a':
|
|
||||||
if (nfunix < MAXFUNIX)
|
|
||||||
@@ -846,9 +848,17 @@
|
|
||||||
case 'h':
|
|
||||||
NoHops = 0;
|
|
||||||
break;
|
|
||||||
+ case 'i':
|
|
||||||
+ if (bind_addr) {
|
|
||||||
+ fprintf(stderr, "Only one -i argument allowed, "
|
|
||||||
+ "the first one is taken.\n");
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ bind_addr = optarg;
|
|
||||||
+ break;
|
|
||||||
case 'l':
|
|
||||||
if (LocalHosts) {
|
|
||||||
- fprintf (stderr, "Only one -l argument allowed," \
|
|
||||||
+ fprintf(stderr, "Only one -l argument allowed, "
|
|
||||||
"the first one is taken.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -1175,7 +1185,7 @@
|
|
||||||
int usage()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
|
|
||||||
- " [-s domainlist] [-f conffile]\n");
|
|
||||||
+ " [-s domainlist] [-f conffile] [-i IP address]\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1217,15 +1227,22 @@
|
|
||||||
int fd, on = 1;
|
|
||||||
struct sockaddr_in sin;
|
|
||||||
|
|
||||||
+ memset(&sin, 0, sizeof(sin));
|
|
||||||
+ sin.sin_family = AF_INET;
|
|
||||||
+ sin.sin_port = LogPort;
|
|
||||||
+ if (bind_addr) {
|
|
||||||
+ if (!inet_aton(bind_addr, &sin.sin_addr)) {
|
|
||||||
+ logerror("syslog: not a valid IP address to bind to.");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
|
||||||
if (fd < 0) {
|
|
||||||
logerror("syslog: Unknown protocol, suspending inet service.");
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
- memset(&sin, 0, sizeof(sin));
|
|
||||||
- sin.sin_family = AF_INET;
|
|
||||||
- sin.sin_port = LogPort;
|
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, \
|
|
||||||
(char *) &on, sizeof(on)) < 0 ) {
|
|
||||||
logerror("setsockopt(REUSEADDR), suspending inet");
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
diff -ur sysklogd-1.4.1-caen-owl-syslogd-bind/sysklogd.8 sysklogd-1.4.1/sysklogd.8
|
|
||||||
--- sysklogd-1.4.1-caen-owl-syslogd-bind/sysklogd.8 Mon Oct 8 07:26:27 2001
|
|
||||||
+++ sysklogd-1.4.1/sysklogd.8 Mon Oct 8 07:30:31 2001
|
|
||||||
@@ -32,6 +32,9 @@
|
|
||||||
.RB [ " \-s "
|
|
||||||
.I domainlist
|
|
||||||
]
|
|
||||||
+.RB [ " \-u"
|
|
||||||
+.IB username
|
|
||||||
+]
|
|
||||||
.RB [ " \-v " ]
|
|
||||||
.LP
|
|
||||||
.SH DESCRIPTION
|
|
||||||
@@ -159,6 +162,19 @@
|
|
||||||
is specified and the host logging resolves to satu.infodrom.north.de
|
|
||||||
no domain would be cut, you will have to specify two domains like:
|
|
||||||
.BR "\-s north.de:infodrom.north.de" .
|
|
||||||
+.TP
|
|
||||||
+.BI "\-u " "username"
|
|
||||||
+This causes the
|
|
||||||
+.B syslogd
|
|
||||||
+daemon to become the named user before starting up logging.
|
|
||||||
+
|
|
||||||
+Note that when this option is in use,
|
|
||||||
+.B syslogd
|
|
||||||
+will open all log files as root when the daemon is first started;
|
|
||||||
+however, after a
|
|
||||||
+.B SIGHUP
|
|
||||||
+the files will be reopened as the non-privileged user. You should
|
|
||||||
+take this into account when deciding the ownership of the log files.
|
|
||||||
.TP
|
|
||||||
.B "\-v"
|
|
||||||
Print version and exit.
|
|
||||||
diff -ur sysklogd-1.4.1-caen-owl-syslogd-bind/syslogd.c sysklogd-1.4.1/syslogd.c
|
|
||||||
--- sysklogd-1.4.1-caen-owl-syslogd-bind/syslogd.c Mon Oct 8 07:26:27 2001
|
|
||||||
+++ sysklogd-1.4.1/syslogd.c Mon Oct 8 07:40:35 2001
|
|
||||||
@@ -491,6 +491,10 @@
|
|
||||||
#include <arpa/nameser.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <resolv.h>
|
|
||||||
+
|
|
||||||
+#include <pwd.h>
|
|
||||||
+#include <grp.h>
|
|
||||||
+
|
|
||||||
#ifndef TESTING
|
|
||||||
#include "pidfile.h"
|
|
||||||
#endif
|
|
||||||
@@ -737,6 +741,7 @@
|
|
||||||
intermediate host. */
|
|
||||||
|
|
||||||
char *bind_addr = NULL; /* bind UDP port to this interface only */
|
|
||||||
+char *server_user = NULL; /* user name to run server as */
|
|
||||||
|
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
@@ -778,6 +783,21 @@
|
|
||||||
static int create_inet_socket();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+static int drop_root(void)
|
|
||||||
+{
|
|
||||||
+ struct passwd *pw;
|
|
||||||
+
|
|
||||||
+ if (!(pw = getpwnam(server_user))) return -1;
|
|
||||||
+
|
|
||||||
+ if (!pw->pw_uid) return -1;
|
|
||||||
+
|
|
||||||
+ if (initgroups(server_user, pw->pw_gid)) return -1;
|
|
||||||
+ if (setgid(pw->pw_gid)) return -1;
|
|
||||||
+ if (setuid(pw->pw_uid)) return -1;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int main(argc, argv)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
@@ -831,7 +851,7 @@
|
|
||||||
funix[i] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:v")) != EOF)
|
|
||||||
+ while ((ch = getopt(argc, argv, "a:dhf:i:l:m:np:rs:u:v")) != EOF)
|
|
||||||
switch((char)ch) {
|
|
||||||
case 'a':
|
|
||||||
if (nfunix < MAXFUNIX)
|
|
||||||
@@ -884,6 +904,9 @@
|
|
||||||
}
|
|
||||||
StripDomains = crunch_list(optarg);
|
|
||||||
break;
|
|
||||||
+ case 'u':
|
|
||||||
+ server_user = optarg;
|
|
||||||
+ break;
|
|
||||||
case 'v':
|
|
||||||
printf("syslogd %s.%s\n", VERSION, PATCHLEVEL);
|
|
||||||
exit (0);
|
|
||||||
@@ -1031,6 +1054,11 @@
|
|
||||||
kill (ppid, SIGTERM);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ if (server_user && drop_root()) {
|
|
||||||
+ dprintf("syslogd: failed to drop root\n");
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* Main loop begins here. */
|
|
||||||
for (;;) {
|
|
||||||
int nfds;
|
|
||||||
@@ -1185,7 +1213,7 @@
|
|
||||||
int usage()
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: syslogd [-drvh] [-l hostlist] [-m markinterval] [-n] [-p path]\n" \
|
|
||||||
- " [-s domainlist] [-f conffile] [-i IP address]\n");
|
|
||||||
+ " [-s domainlist] [-f conffile] [-i IP address] [-u username]\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
diff -ur sysklogd-1.4.1.orig/syslogd.c sysklogd-1.4.1/syslogd.c
|
|
||||||
--- sysklogd-1.4.1.orig/syslogd.c Sun Mar 11 19:40:10 2001
|
|
||||||
+++ sysklogd-1.4.1/syslogd.c Sun Apr 18 01:42:21 2004
|
|
||||||
@@ -1254,30 +1254,26 @@
|
|
||||||
crunch_list(list)
|
|
||||||
char *list;
|
|
||||||
{
|
|
||||||
- int count, i;
|
|
||||||
+ int i, m, n;
|
|
||||||
char *p, *q;
|
|
||||||
char **result = NULL;
|
|
||||||
|
|
||||||
p = list;
|
|
||||||
|
|
||||||
/* strip off trailing delimiters */
|
|
||||||
- while (p[strlen(p)-1] == LIST_DELIMITER) {
|
|
||||||
- count--;
|
|
||||||
+ while (*p && p[strlen(p)-1] == LIST_DELIMITER)
|
|
||||||
p[strlen(p)-1] = '\0';
|
|
||||||
- }
|
|
||||||
/* cut off leading delimiters */
|
|
||||||
- while (p[0] == LIST_DELIMITER) {
|
|
||||||
- count--;
|
|
||||||
+ while (p[0] == LIST_DELIMITER)
|
|
||||||
p++;
|
|
||||||
- }
|
|
||||||
|
|
||||||
- /* count delimiters to calculate elements */
|
|
||||||
- for (count=i=0; p[i]; i++)
|
|
||||||
- if (p[i] == LIST_DELIMITER) count++;
|
|
||||||
+ /* count delimiters to calculate the number of elements */
|
|
||||||
+ for (n = i = 0; p[i]; i++)
|
|
||||||
+ if (p[i] == LIST_DELIMITER) n++;
|
|
||||||
|
|
||||||
- if ((result = (char **)malloc(sizeof(char *) * count+2)) == NULL) {
|
|
||||||
+ if ((result = (char **)malloc(sizeof(char *) * (n + 2))) == NULL) {
|
|
||||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
|
||||||
- exit(0);
|
|
||||||
+ exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@@ -1285,30 +1281,28 @@
|
|
||||||
* characters are different from any delimiters,
|
|
||||||
* so we don't have to care about this.
|
|
||||||
*/
|
|
||||||
- count = 0;
|
|
||||||
- while ((q=strchr(p, LIST_DELIMITER))) {
|
|
||||||
- result[count] = (char *) malloc((q - p + 1) * sizeof(char));
|
|
||||||
- if (result[count] == NULL) {
|
|
||||||
+ m = 0;
|
|
||||||
+ while ((q = strchr(p, LIST_DELIMITER)) && m < n) {
|
|
||||||
+ result[m] = (char *) malloc((q - p + 1) * sizeof(char));
|
|
||||||
+ if (result[m] == NULL) {
|
|
||||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
|
||||||
- exit(0);
|
|
||||||
+ exit(1);
|
|
||||||
}
|
|
||||||
- strncpy(result[count], p, q - p);
|
|
||||||
- result[count][q - p] = '\0';
|
|
||||||
+ memcpy(result[m], p, q - p);
|
|
||||||
+ result[m][q - p] = '\0';
|
|
||||||
p = q; p++;
|
|
||||||
- count++;
|
|
||||||
+ m++;
|
|
||||||
}
|
|
||||||
- if ((result[count] = \
|
|
||||||
- (char *)malloc(sizeof(char) * strlen(p) + 1)) == NULL) {
|
|
||||||
+ if ((result[m] = strdup(p)) == NULL) {
|
|
||||||
printf ("Sorry, can't get enough memory, exiting.\n");
|
|
||||||
- exit(0);
|
|
||||||
+ exit(1);
|
|
||||||
}
|
|
||||||
- strcpy(result[count],p);
|
|
||||||
- result[++count] = NULL;
|
|
||||||
+ result[++m] = NULL;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
- count=0;
|
|
||||||
- while (result[count])
|
|
||||||
- dprintf ("#%d: %s\n", count, StripDomains[count++]);
|
|
||||||
+ m = 0;
|
|
||||||
+ while (result[m])
|
|
||||||
+ dprintf ("#%d: %s\n", m, result[m++]);
|
|
||||||
#endif
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Fix borrowed from mandriva
|
|
||||||
# disable umount -r for non-root users to fix privilege escalation (CAN-2005-2876)
|
|
||||||
|
|
||||||
--- util-linux-2.12a/mount/umount.c.can-2005-2876 2005-09-19 20:18:32.011686865 -0600
|
|
||||||
+++ util-linux-2.12a/mount/umount.c 2005-09-19 20:19:02.699173130 -0600
|
|
||||||
@@ -695,7 +695,7 @@
|
|
||||||
|
|
||||||
if (getuid () != geteuid ()) {
|
|
||||||
suid = 1;
|
|
||||||
- if (all || types || nomtab || force)
|
|
||||||
+ if (all || types || nomtab || force || remount)
|
|
||||||
die (2, _("umount: only root can do that"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Binary file not shown.
Reference in New Issue
Block a user