From 00c2e5a74486d56e8e0d5c86e25dae7c46894768 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:09:46 -0500 Subject: [PATCH] Import 1.1.70 --- Makefile | 2 +- arch/i386/Makefile | 4 + arch/i386/config.in | 15 +++- drivers/char/console.c | 168 ++++++++++++++++++++++++++++++++++++++ drivers/scsi/ChangeLog | 2 +- drivers/scsi/st.c | 2 +- fs/msdos/mmap.c | 102 ----------------------- fs/proc/net.c | 32 ++++++++ fs/sysv/mmap.c | 85 ------------------- include/asm-alpha/types.h | 29 +++++++ include/asm-i386/types.h | 17 ++++ include/linux/ip.h | 38 ++++----- include/linux/proc_fs.h | 10 +++ include/linux/tcp.h | 20 ++--- kernel/bios32.c | 10 --- kernel/ksyms.c | 17 +++- net/inet/af_inet.c | 10 ++- net/inet/dev.c | 2 + net/inet/igmp.c | 2 +- net/inet/igmp.h | 2 +- net/inet/ip.c | 3 +- net/inet/ip_fw.c | 79 ++++++++++++++++-- net/inet/route.c | 19 ++++- net/inet/udp.c | 8 +- 24 files changed, 429 insertions(+), 249 deletions(-) delete mode 100644 fs/msdos/mmap.c delete mode 100644 fs/sysv/mmap.c diff --git a/Makefile b/Makefile index 3aeaa1c17f44..035206caf76b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 69 +SUBLEVEL = 70 ARCH = i386 diff --git a/arch/i386/Makefile b/arch/i386/Makefile index 1b878067ada2..0003cfd24e21 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -22,8 +22,12 @@ STRIP =strip ifdef CONFIG_M486 CFLAGS := $(CFLAGS) -m486 else +ifdef CONFIG_M586 +CFLAGS := $(CFLAGS) -mpentium +else CFLAGS := $(CFLAGS) -m386 endif +endif zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem $(MAKE) -C zBoot diff --git a/arch/i386/config.in b/arch/i386/config.in index e88fad8a3498..2f1ba4012b03 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -11,9 +11,20 @@ bool 'Normal harddisk support' CONFIG_BLK_DEV_HD y bool 'XT harddisk support' CONFIG_BLK_DEV_XD n bool 'Networking support' CONFIG_NET y bool 'Limit memory to low 16MB' CONFIG_MAX_16M n +bool 'PCI bios support' CONFIG_PCI n bool 'System V IPC' CONFIG_SYSVIPC y bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF y +#bool 'Use -mpentium flag for Pentium-specific optimizations' CONFIG_M586 n +#if [ "$CONFIG_M586" = "n" ]; then bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y +#fi + +comment 'Screen saver mode' + +bool 'VESA Power Saving Protocol Support' CONFIG_VESA_PSPM n +if [ "$CONFIG_VESA_PSPM" = "y" ]; then +bool 'VESA PSPM Force Off' CONFIG_PSPM_FORCE_OFF n +fi if [ "$CONFIG_NET" = "y" ]; then comment 'Networking options' @@ -60,7 +71,9 @@ bool 'BusLogic SCSI support' CONFIG_SCSI_BUSLOGIC n bool 'UltraStor 14F/34F support' CONFIG_SCSI_U14_34F n bool 'Future Domain 16xx SCSI support' CONFIG_SCSI_FUTURE_DOMAIN n bool 'Generic NCR5380 SCSI support' CONFIG_SCSI_GENERIC_NCR5380 n -bool 'NCR53c7,8xx SCSI support' CONFIG_SCSI_NCR53C7xx n +if [ "$CONFIG_PCI" = "y" ]; then + bool 'NCR53c7,8xx SCSI support' CONFIG_SCSI_NCR53C7xx n +fi bool 'Always IN2000 SCSI support (test release)' CONFIG_SCSI_IN2000 n bool 'PAS16 SCSI support' CONFIG_SCSI_PAS16 n bool 'QLOGIC SCSI support' CONFIG_SCSI_QLOGIC n diff --git a/drivers/char/console.c b/drivers/char/console.c index 7a48e787167e..eb6e2251a86d 100644 --- a/drivers/char/console.c +++ b/drivers/char/console.c @@ -160,7 +160,9 @@ static unsigned short *vc_scrbuf[MAX_NR_CONSOLES]; static int console_blanked = 0; static int blankinterval = 10*60*HZ; +#ifndef CONFIG_VESA_PSPM static long blank_origin, blank__origin, unblank_origin; +#endif struct vc_data { unsigned long vc_screenbuf_size; @@ -288,6 +290,159 @@ static struct vc { #define vcmode (vt_cons[currcons]->vc_mode) #define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) +#ifdef CONFIG_VESA_PSPM +/* + * This section(s) handles the VESA Power Saving Protocol that let a * + * monitor be powered down whenever not needed for a longer time. * + * VESA protocol defines: * + * * + * Mode/Status HSync VSync Video * + * ---------------------------------------------- * + * "On" on on active * + * "Suspend" {either} on off blank * + * { or } off on blank * + * "Off" off off blank << PSPM_FORCE_OFF * + * * + * Original code taken from the Power Management Utility (PMU) of * + * Huang shi chao, delivered together with many new monitor models * + * capable of the VESA Power Saving Protocol. * + * Adapted to Linux by Christoph Rimek (chrimek@toppoint.de) 15-may-94 * + * Re-Adapted by Nicholas Leon (nicholas@neko.binary9.com) 10/94 * + * (with minor reorganization/changes) * + */ + + +static void vesa_blank(void); +static void vesa_unblank(void); + +#define seq_port_reg (0x3c4) /* Sequencer register select port */ +#define seq_port_val (0x3c5) /* Sequencer register value port */ +#define video_misc_rd (0x3cc) /* Video misc. read port */ +#define video_misc_wr (0x3c2) /* Video misc. write port */ + +/* structure holding original VGA register settings */ +static struct { + unsigned char SeqCtrlIndex; /* Sequencer Index reg. */ + unsigned char CrtCtrlIndex; /* CRT-Contr. Index reg. */ + unsigned char CrtMiscIO; /* Miscellaneous register */ +#ifdef CONFIG_PSPM_FORCE_OFF + unsigned char HorizontalTotal; /* CRT-Controller:00h */ + unsigned char HorizDisplayEnd; /* CRT-Controller:01h */ + unsigned char StartHorizRetrace; /* CRT-Controller:04h */ + unsigned char EndHorizRetrace; /* CRT-Controller:05h */ +#endif + unsigned char Overflow; /* CRT-Controller:07h */ + unsigned char StartVertRetrace; /* CRT-Controller:10h */ + unsigned char EndVertRetrace; /* CRT-Controller:11h */ + unsigned char ModeControl; /* CRT-Controller:17h */ + unsigned char ClockingMode; /* Seq-Controller:01h */ +} vga; + +/* routine to blank a vesa screen */ +static void vesa_blank(void) +{ + /* save original values of VGA controller registers */ + cli(); + vga.SeqCtrlIndex = inb_p(seq_port_reg); + vga.CrtCtrlIndex = inb_p(video_port_reg); + vga.CrtMiscIO = inb_p(video_misc_rd); + sti(); +#ifdef CONFIG_PSPM_FORCE_OFF + outb_p(0x00,video_port_reg); /* HorizontalTotal */ + vga.HorizontalTotal = inb_p(video_port_val); + outb_p(0x01,video_port_reg); /* HorizDisplayEnd */ + vga.HorizDisplayEnd = inb_p(video_port_val); + outb_p(0x04,video_port_reg); /* StartHorizRetrace */ + vga.StartHorizRetrace = inb_p(video_port_val); + outb_p(0x05,video_port_reg); /* EndHorizRetrace */ + vga.EndHorizRetrace = inb_p(video_port_val); +#endif + outb_p(0x07,video_port_reg); /* Overflow */ + vga.Overflow = inb_p(video_port_val); + outb_p(0x10,video_port_reg); /* StartVertRetrace */ + vga.StartVertRetrace = inb_p(video_port_val); + outb_p(0x11,video_port_reg); /* EndVertRetrace */ + vga.EndVertRetrace = inb_p(video_port_val); + outb_p(0x17,video_port_reg); /* ModeControl */ + vga.ModeControl = inb_p(video_port_val); + outb_p(0x01,seq_port_reg); /* ClockingMode */ + vga.ClockingMode = inb_p(seq_port_val); + + /* assure that video is enabled */ + /* "0x20" is VIDEO_ENABLE_bit in register 01 of sequencer */ + cli(); + outb_p(0x01,seq_port_reg); + outb_p(vga.ClockingMode | 0x20,seq_port_val); + +/* sti(); + cli(); */ + + /* test for vertical retrace in process.... */ + if ((vga.CrtMiscIO & 0x80) == 0x80) + outb_p(vga.CrtMiscIO & 0xef,video_misc_wr); + + /* Set to minimum (0) and * + * to maximum (incl. overflow) * + * Result: turn off vertical sync (VSync) pulse */ + outb_p(0x10,video_port_reg); /* StartVertRetrace */ + outb_p(0xff,video_port_val); /* maximum value */ + outb_p(0x11,video_port_reg); /* EndVertRetrace */ + outb_p(0x40,video_port_val); /* minimum (bits 0..3) */ + outb_p(0x07,video_port_reg); /* Overflow */ + outb_p(vga.Overflow | 0x84,video_port_val); /* bits 9,10 of */ + /* vert. retrace */ +#ifdef CONFIG_PSPM_FORCE_OFF + /* Set to minimum (0) and * + * to maximum * + * Result: turn off horizontal sync (HSync) pulse */ + outb_p(0x04,video_port_reg); /* StartHorizRetrace */ + outb_p(0xff,video_port_val); /* maximum */ + outb_p(0x05,video_port_reg); /* EndHorizRetrace */ + outb_p(0x00,video_port_val); /* minimum (0) */ +#endif + /* restore both index registers */ + outb_p(vga.SeqCtrlIndex,seq_port_reg); + outb_p(vga.CrtCtrlIndex,video_port_reg); + sti(); + +} + +/* routine to unblank a vesa screen */ +static void vesa_unblank(void) +{ + /* restore original values of VGA controller registers */ + cli(); + outb_p(vga.CrtMiscIO,video_misc_wr); +#ifdef CONFIG_PSPM_FORCE_OFF + outb_p(0x00,video_port_reg); /* HorizontalTotal */ + outb_p(vga.HorizontalTotal,video_port_val); + outb_p(0x01,video_port_reg); /* HorizDisplayEnd */ + outb_p(vga.HorizDisplayEnd,video_port_val); + outb_p(0x04,video_port_reg); /* StartHorizRetrace */ + outb_p(vga.StartHorizRetrace,video_port_val); + outb_p(0x05,video_port_reg); /* EndHorizRetrace */ + outb_p(vga.EndHorizRetrace,video_port_val); +#endif + outb_p(0x07,video_port_reg); /* Overflow */ + outb_p(vga.Overflow,video_port_val); + outb_p(0x10,video_port_reg); /* StartVertRetrace */ + outb_p(vga.StartVertRetrace,video_port_val); + outb_p(0x11,video_port_reg); /* EndVertRetrace */ + outb_p(vga.EndVertRetrace,video_port_val); + outb_p(0x17,video_port_reg); /* ModeControl */ + outb_p(vga.ModeControl,video_port_val); + outb_p(0x01,seq_port_reg); /* ClockingMode */ + outb_p(vga.ClockingMode,seq_port_val); + + /* restore index/control registers */ + outb_p(vga.SeqCtrlIndex,seq_port_reg); + outb_p(vga.CrtCtrlIndex,video_port_reg); + sti(); +} + +#endif /* CONFIG_VESA_PSPM */ + + static void * memsetw(void * s, unsigned short c, unsigned int count) { __asm__("cld\n\t" @@ -2032,7 +2187,9 @@ static void set_scrmem(int currcons, long offset) void blank_screen(void) { +#ifndef CONFIG_VESA_PSPM int currcons; +#endif if (console_blanked) return; @@ -2043,6 +2200,9 @@ void blank_screen(void) } timer_table[BLANK_TIMER].fn = unblank_screen; +#ifdef CONFIG_VESA_PSPM + vesa_blank(); +#else /* try not to lose information by blanking, and not to waste memory */ currcons = fg_console; has_scrolled = 0; @@ -2053,14 +2213,17 @@ void blank_screen(void) unblank_origin = origin; memsetw((void *)blank_origin, BLANK, video_mem_term-blank_origin); hide_cursor(); +#endif console_blanked = fg_console + 1; } void unblank_screen(void) { int currcons; +#ifndef CONFIG_VESA_PSPM int resetorg; long offset; +#endif if (!console_blanked) return; @@ -2075,6 +2238,10 @@ void unblank_screen(void) timer_active |= 1<request.dev = -1; /* Mark as not busy */ (STp->buffer)->in_use = 0; STp->buffer = NULL; - STp->density = 0; /* Clear the errorneus "residue" */ + STp->density = 0; /* Clear the erroneous "residue" */ STp->write_prot = 0; STp->block_size = 0; STp->eof = ST_NOEOF; diff --git a/fs/msdos/mmap.c b/fs/msdos/mmap.c deleted file mode 100644 index 0e85584e9c91..000000000000 --- a/fs/msdos/mmap.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * fs/msdos/mmap.c - * - * Written by Jacques Gelinas (jacques@solucorp.qc.ca) - * Inspired by fs/nfs/mmap.c (Jaon Tombs 15 Aug 1993) - * - * msdos mmap handling - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Fill in the supplied page for mmap - */ -static unsigned long msdos_file_mmap_nopage( - struct vm_area_struct * area, - unsigned long address, - unsigned long page, - int error_code) -{ - struct inode * inode = area->vm_inode; - unsigned int clear; - int pos; - long gap; /* distance from eof to pos */ - - address &= PAGE_MASK; - pos = address - area->vm_start + area->vm_offset; - - clear = 0; - gap = inode->i_size - pos; - if (gap <= 0){ - /* mmaping beyond end of file */ - clear = PAGE_SIZE; - }else{ - int cur_read; - int need_read; - struct file filp; - if (gap < PAGE_SIZE){ - clear = PAGE_SIZE - gap; - } - filp.f_pos = pos; - need_read = PAGE_SIZE - clear; - { - unsigned long cur_fs = get_fs(); - set_fs (KERNEL_DS); - cur_read = msdos_file_read (inode,&filp,(char*)page - ,need_read); - set_fs (cur_fs); - } - if (cur_read != need_read){ - printk ("MSDOS: Error while reading an mmap file %d <> %d\n" - ,cur_read,need_read); - } - } - if (clear > 0){ - memset ((char*)page+PAGE_SIZE-clear,0,clear); - } - return page; -} - -struct vm_operations_struct msdos_file_mmap = { - NULL, /* open */ - NULL, /* close */ - msdos_file_mmap_nopage, /* nopage */ - NULL, /* wppage */ - NULL, /* share */ - NULL, /* unmap */ -}; - -/* - * This is used for a general mmap of an msdos file - * Returns 0 if ok, or a negative error code if not. - */ -int msdos_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma) -{ - if (vma->vm_page_prot & PAGE_RW) /* only PAGE_COW or read-only supported now */ - return -EINVAL; - if (vma->vm_offset & (inode->i_sb->s_blocksize - 1)) - return -EINVAL; - if (!inode->i_sb || !S_ISREG(inode->i_mode)) - return -EACCES; - if (!IS_RDONLY(inode)) { - inode->i_atime = CURRENT_TIME; - inode->i_dirt = 1; - } - - vma->vm_inode = inode; - inode->i_count++; - vma->vm_ops = &msdos_file_mmap; - return 0; -} - diff --git a/fs/proc/net.c b/fs/proc/net.c index 601f590d3e32..5bd2fe9588e9 100644 --- a/fs/proc/net.c +++ b/fs/proc/net.c @@ -50,6 +50,10 @@ extern int rarp_get_info(char *, char **, off_t, int); extern int dev_get_info(char *, char **, off_t, int); extern int rt_get_info(char *, char **, off_t, int); extern int snmp_get_info(char *, char **, off_t, int); +extern int ip_acct_procinfo(char *, char **, off_t, int); +extern int ip_fw_blk_procinfo(char *, char **, off_t, int); +extern int ip_fw_fwd_procinfo(char *, char **, off_t, int); +extern int ip_mc_procinfo(char *, char **, off_t, int); #endif /* CONFIG_INET */ #ifdef CONFIG_IPX extern int ipx_get_info(char *, char **, off_t, int); @@ -115,6 +119,16 @@ static struct proc_dir_entry net_dir[] = { #ifdef CONFIG_INET_RARP { PROC_NET_RARP, 4, "rarp"}, #endif +#ifdef CONFIG_IP_MULTICAST + { PROC_NET_IGMP, 4, "igmp"}, +#endif +#ifdef CONFIG_IP_FIREWALL + { PROC_NET_IPFWFWD, 10, "ip_forward"}, + { PROC_NET_IPBLFWD, 8, "ip_block"}, +#endif +#ifdef CONFIG_IP_ACCT + { PROC_NET_IPACCT, 7, "ip_acct"}, +#endif #endif /* CONFIG_INET */ #ifdef CONFIG_IPX { PROC_NET_IPX_ROUTE, 9, "ipx_route" }, @@ -237,6 +251,24 @@ static int proc_readnet(struct inode * inode, struct file * file, case PROC_NET_SNMP: length = snmp_get_info(page, &start, file->f_pos,thistime); break; +#ifdef CONFIG_IP_MULTICAST + case PROC_NET_IGMP: + length = ip_mc_procinfo(page, &start, file->f_pos,thistime); + break; +#endif +#ifdef CONFIG_IP_FIREWALL + case PROC_NET_IPFWFWD: + length = ip_fw_fwd_procinfo(page, &start, file->f_pos,thistime); + break; + case PROC_NET_IPBLFWD: + length = ip_fw_blk_procinfo(page, &start, file->f_pos,thistime); + break; +#endif +#ifdef CONFIG_IP_ACCT + case PROC_NET_IPACCT: + length = ip_acct_procinfo(page, &start, file->f_pos,thistime); + break; +#endif #ifdef CONFIG_INET_RARP case PROC_NET_RARP: length = rarp_get_info(page,&start,file->f_pos,thistime); diff --git a/fs/sysv/mmap.c b/fs/sysv/mmap.c deleted file mode 100644 index 3ec3867a97bd..000000000000 --- a/fs/sysv/mmap.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * linux/fs/sysv/mmap.c - * - * mm/memory.c, mm/mmap.c - * Copyright (C) 1991, 1992, 1993 Linus Torvalds - * - * nfs/mmap.c - * Copyright (C) 1993 Jon Tombs - * - * fs/msdos/mmap.c - * Copyright (C) 1994 Jacques Gelinas - * - * fs/sysv/mmap.c - * Copyright (C) 1994 Bruno Haible - * - * SystemV/Coherent mmap handling - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Fill in the supplied page for mmap - */ -static unsigned long sysv_file_mmap_nopage (struct vm_area_struct * area, - unsigned long address, unsigned long page, int no_share) -{ - int remaining, count, old_fs; - struct file filp; - - address &= PAGE_MASK; - /* prepare a file pointer */ - filp.f_pos = address - area->vm_start + area->vm_offset; - filp.f_reada = 0; - remaining = area->vm_end - address; - if (remaining > PAGE_SIZE) - remaining = PAGE_SIZE; - /* read from the file. page is in kernel space, not user space. */ - old_fs = get_fs(); set_fs(get_ds()); - count = sysv_file_read (area->vm_inode, &filp, (char *)page, remaining); - set_fs(old_fs); - if (count < 0) - count = 0; /* do nothing on I/O error ?? */ - else - remaining -= count; - if (remaining > 0) - memset((char *)page + count, 0, remaining); - return page; -} - -static struct vm_operations_struct sysv_file_mmap = { - NULL, /* open */ - NULL, /* close */ - sysv_file_mmap_nopage, /* nopage */ - NULL, /* wppage */ - NULL, /* share */ - NULL, /* unmap */ -}; - -int sysv_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma) -{ - if (vma->vm_page_prot & PAGE_RW) /* only PAGE_COW or read-only supported right now */ - return -EINVAL; - if (vma->vm_offset & (inode->i_sb->s_blocksize - 1)) - return -EINVAL; - if (!inode->i_sb || !S_ISREG(inode->i_mode)) - return -EACCES; - if (!IS_RDONLY(inode)) { - inode->i_atime = CURRENT_TIME; - inode->i_dirt = 1; - } - - vma->vm_inode = inode; - inode->i_count++; - vma->vm_ops = &sysv_file_mmap; - return 0; -} diff --git a/include/asm-alpha/types.h b/include/asm-alpha/types.h index b532a6641e83..0cfafa43e934 100644 --- a/include/asm-alpha/types.h +++ b/include/asm-alpha/types.h @@ -1,6 +1,35 @@ #ifndef _ALPHA_TYPES_H #define _ALPHA_TYPES_H +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef signed char __s8; +typedef unsigned char __u8; + +typedef signed short __s16; +typedef unsigned short __u16; + +typedef signed int __s32; +typedef unsigned int __u32; + +/* + * There are 32-bit compilers for the alpha out there.. + */ +#if ((~0UL) == 0xffffffff) + +typedef signed long long __s64; +typedef unsigned long long __u64; + +#else + +typedef signed long __s64; +typedef unsigned long __u64; + +#endif + /* * These aren't exported outside the kernel to avoid name space clashes */ diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h index 129bd4918ea8..a5197c3340e8 100644 --- a/include/asm-i386/types.h +++ b/include/asm-i386/types.h @@ -1,6 +1,23 @@ #ifndef _I386_TYPES_H #define _I386_TYPES_H +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef signed char __s8; +typedef unsigned char __u8; + +typedef signed short __s16; +typedef unsigned short __u16; + +typedef signed long __s32; +typedef unsigned long __u32; + +typedef signed long long __s64; +typedef unsigned long long __u64; + /* * These aren't exported outside the kernel to avoid name space clashes */ diff --git a/include/linux/ip.h b/include/linux/ip.h index 1d3789638f12..f7768e621397 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -29,24 +29,24 @@ struct timestamp { - u8 len; - u8 ptr; + __u8 len; + __u8 ptr; union { #if defined(__i386__) - u8 flags:4, + __u8 flags:4, overflow:4; #elif defined(__mc68000__) - u8 overflow:4, + __u8 overflow:4, flags:4; #elif defined(__alpha__) - u8 flags:4, + __u8 flags:4, overflow:4; #else #error "Adjust this structure to match your CPU" #endif - u8 full_char; + __u8 full_char; } x; - u32 data[9]; + __u32 data[9]; }; @@ -74,26 +74,26 @@ struct options { struct iphdr { #if defined(__i386__) - u8 ihl:4, + __u8 ihl:4, version:4; #elif defined (__mc68000__) - u8 version:4, + __u8 version:4, ihl:4; #elif defined (__alpha__) - u8 ihl:4, + __u8 ihl:4, version:4; #else #error "Adjust this structure to match your CPU" #endif - u8 tos; - u16 tot_len; - u16 id; - u16 frag_off; - u8 ttl; - u8 protocol; - u16 check; - u32 saddr; - u32 daddr; + __u8 tos; + __u16 tot_len; + __u16 id; + __u16 frag_off; + __u8 ttl; + __u8 protocol; + __u16 check; + __u32 saddr; + __u32 daddr; /*The options start here. */ }; diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 70e25bf42343..fe40f4b4e4bd 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -58,6 +58,16 @@ enum net_directory_inos { #ifdef CONFIG_INET_RARP PROC_NET_RARP, #endif +#ifdef CONFIG_IP_MULTICAST + PROC_NET_IGMP, +#endif +#ifdef CONFIG_IP_FIREWALL + PROC_NET_IPFWFWD, + PROC_NET_IPBLFWD, +#endif +#ifdef CONFIG_IP_ACCT + PROC_NET_IPACCT, +#endif #endif #ifdef CONFIG_IPX PROC_NET_IPX_ROUTE, diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 4acc22cae1da..938a201d8247 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -23,12 +23,12 @@ struct tcphdr { - u16 source; - u16 dest; - u32 seq; - u32 ack_seq; + __u16 source; + __u16 dest; + __u32 seq; + __u32 ack_seq; #if defined(__i386__) - u16 res1:4, + __u16 res1:4, doff:4, fin:1, syn:1, @@ -38,7 +38,7 @@ struct tcphdr { urg:1, res2:2; #elif defined(__mc68000__) - u16 res2:2, + __u16 res2:2, urg:1, ack:1, psh:1, @@ -48,7 +48,7 @@ struct tcphdr { doff:4, res1:4; #elif defined(__alpha__) - u16 res1:4, + __u16 res1:4, doff:4, fin:1, syn:1, @@ -60,9 +60,9 @@ struct tcphdr { #else #error "Adjust this structure for your cpu alignment rules" #endif - u16 window; - u16 check; - u16 urg_ptr; + __u16 window; + __u16 check; + __u16 urg_ptr; }; diff --git a/kernel/bios32.c b/kernel/bios32.c index 311dd111e95e..e81faff1a9d9 100644 --- a/kernel/bios32.c +++ b/kernel/bios32.c @@ -41,16 +41,6 @@ #include -/* - * It would seem some PCI bioses are buggy, so we don't actually use these - * routines unless we need to.. - */ -#ifdef CONFIG_SCSI_NCR53C7xx - #define CONFIG_PCI -#else - #undef CONFIG_PCI -#endif - #define PCIBIOS_PCI_FUNCTION_ID 0xb1XX #define PCIBIOS_PCI_BIOS_PRESENT 0xb101 #define PCIBIOS_FIND_PCI_DEVICE 0xb102 diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 274e81870f20..22a748eaefa2 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -34,12 +34,13 @@ #include #include #endif +#ifdef CONFIG_PCI +#include +#endif #include extern char floppy_track_buffer[]; extern void set_device_ro(int dev,int flag); -#include -#include extern void *sys_call_table; @@ -70,6 +71,18 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */ X(EISA_bus), X(wp_works_ok), +#ifdef CONFIG_PCI + /* PCI BIOS support */ + X(pcibios_find_class), + X(pcibios_find_device), + X(pcibios_read_config_byte), + X(pcibios_read_config_word), + X(pcibios_read_config_dword), + X(pcibios_write_config_byte), + X(pcibios_write_config_word), + X(pcibios_write_config_dword), +#endif + /* process memory management */ X(verify_area), X(do_mmap), diff --git a/net/inet/af_inet.c b/net/inet/af_inet.c index ef211f8f48fd..87699a990d13 100644 --- a/net/inet/af_inet.c +++ b/net/inet/af_inet.c @@ -444,8 +444,15 @@ static int inet_listen(struct socket *sock, int backlog) return -EAGAIN; /* We might as well re use these. */ + /* + * note that the backlog is "unsigned char", so truncate it + * somewhere. We might as well truncate it to what everybody + * else does.. + */ + if (backlog > 5) + backlog = 5; sk->max_ack_backlog = backlog; - if (sk->state != TCP_LISTEN) + if (sk->state != TCP_LISTEN) { sk->ack_backlog = 0; sk->state = TCP_LISTEN; @@ -656,6 +663,7 @@ static int inet_create(struct socket *sock, int protocol) sk->ip_mc_loop=0; sk->ip_mc_ttl=1; *sk->ip_mc_name=0; + sk->ip_mc_list=NULL; #endif sk->state_change = def_callback1; diff --git a/net/inet/dev.c b/net/inet/dev.c index 7fd20cc9b9d4..1f8c9c93ec63 100644 --- a/net/inet/dev.c +++ b/net/inet/dev.c @@ -1442,6 +1442,8 @@ int dev_ioctl(unsigned int cmd, void *arg) case SIOCSIFMEM: case SIOCSIFMAP: case SIOCSIFSLAVE: + case SIOCADDMULTI: + case SIOCDELMULTI: if (!suser()) return -EPERM; return dev_ifsioc(arg, cmd); diff --git a/net/inet/igmp.c b/net/inet/igmp.c index 0825813c654f..f921c685da61 100644 --- a/net/inet/igmp.c +++ b/net/inet/igmp.c @@ -5,7 +5,7 @@ * Alan Cox * * WARNING: - * This is a 'prelimary' implementation... on your own head + * This is a 'preliminary' implementation... on your own head * be it. * * This program is free software; you can redistribute it and/or diff --git a/net/inet/igmp.h b/net/inet/igmp.h index 8c9aca36376f..f4e213773976 100644 --- a/net/inet/igmp.h +++ b/net/inet/igmp.h @@ -5,7 +5,7 @@ * Alan Cox * * WARNING: - * This is a 'prelimary' implementation... on your own head + * This is a 'preliminary' implementation... on your own head * be it. * * This program is free software; you can redistribute it and/or diff --git a/net/inet/ip.c b/net/inet/ip.c index dea0dacb08af..b85336590e82 100644 --- a/net/inet/ip.c +++ b/net/inet/ip.c @@ -876,7 +876,7 @@ static struct sk_buff *ip_glue(struct ipq *qp) fp = qp->fragments; while(fp != NULL) { - if(count+fp->len>skb->len) + if(count+fp->len > skb->len) { printk("Invalid fragment list: Fragment over size.\n"); ip_free(qp); @@ -1610,6 +1610,7 @@ int ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) skb=ip_defrag(iph,skb,dev); if(skb==NULL) return 0; + skb->dev = dev; iph=skb->h.iph; } diff --git a/net/inet/ip_fw.c b/net/inet/ip_fw.c index adad2e6032e6..34810303edfe 100644 --- a/net/inet/ip_fw.c +++ b/net/inet/ip_fw.c @@ -214,7 +214,7 @@ int ip_fw_chk(struct iphdr *ip, struct ip_fw *chain) } /* * At this moment we surely know the protocol of this - * packet and we'll check if it matches,then proceed futher.. + * packet and we'll check if it matches,then proceed further.. */ if (proto==frwl_proto) { @@ -387,7 +387,7 @@ addr_match: } /* * At this moment we surely know the protocol of this - * packet and we'll check if it matches,then proceed futher.. + * packet and we'll check if it matches,then proceed further.. */ if (proto==frwl_proto) { @@ -628,10 +628,7 @@ skip_check: if (chtmp_prev) chtmp_prev->next=ftmp; else - { *chainptr=ftmp; - printk("ip_fw: add_to_chain: Can't happen"); - } restore_flags(flags); return(0); } @@ -866,7 +863,7 @@ int ip_fw_ctl(int stage, void *m, int len) /* * Here we really working hard-adding new elements - * to blocking/forwarding chains or deleting'em + * to blocking/forwarding chains or deleting 'em */ if ( stage == IP_FW_ADD_BLK || stage == IP_FW_ADD_FWD @@ -905,3 +902,73 @@ int ip_fw_ctl(int stage, void *m, int len) return(EINVAL); } #endif /* CONFIG_IP_FIREWALL */ + +#if defined(CONFIG_IP_FIREWALL) || defined(CONFIG_IP_ACCT) + +static int ip_chain_procinfo(struct ip_fw *chain, char *buffer, char **start, off_t offset, int length) +{ + off_t pos=0, begin=0; + struct ip_fw *i; + unsigned long flags; + int len=0; + + + len=sprintf(buffer,"Firewall Rules\n"); + save_flags(flags); + cli(); + + i=chain; + + while(i!=NULL) + { + len+=sprintf(buffer+len,"%08lX/%08lX->%08lX/%08lX %X ", + ntohl(i->src.s_addr),ntohl(i->src_mask.s_addr), + ntohl(i->dst.s_addr),ntohl(i->dst_mask.s_addr), + i->flags); + len+=sprintf(buffer+len,"%u %u %lu %lu ", + i->n_src_p,i->n_dst_p, i->p_cnt,i->b_cnt); + len+=sprintf(buffer+len,"%u %u %u %u %u %u %u %u %u %u\n", + i->ports[0],i->ports[1],i->ports[2],i->ports[3], + i->ports[4],i->ports[5],i->ports[6],i->ports[7], + i->ports[8],i->ports[9]); + pos=begin+len; + if(posoffset+length) + break; + i=i->next; + } + restore_flags(flags); + *start=buffer+(offset-begin); + len-=(offset-begin); + if(len>length) + len=length; + return len; +} +#endif + +#ifdef CONFIG_IP_ACCT + +int ip_acct_procinfo(char *buffer, char **start, off_t offset, int length) +{ + return ip_chain_procinfo(ip_acct_chain, buffer,start,offset,length); +} + +#endif + +#ifdef CONFIG_IP_FIREWALL + +int ip_fw_blk_procinfo(char *buffer, char **start, off_t offset, int length) +{ + return ip_chain_procinfo(ip_fw_blk_chain, buffer,start,offset,length); +} + +int ip_fw_fwd_procinfo(char *buffer, char **start, off_t offset, int length) +{ + return ip_chain_procinfo(ip_fw_fwd_chain, buffer,start,offset,length); +} + +#endif diff --git a/net/inet/route.c b/net/inet/route.c index 58401d742c30..e2aa3aeb2d95 100644 --- a/net/inet/route.c +++ b/net/inet/route.c @@ -23,6 +23,7 @@ * Alan Cox : MTU in route table * Alan Cox : MSS actually. Also added the window * clamper. + * Sam Lantinga : Fixed route matching in rt_del() * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -66,7 +67,7 @@ static struct rtable *rt_loopback = NULL; * Remove a routing table entry. */ -static void rt_del(unsigned long dst) +static void rt_del(unsigned long dst, char *devname) { struct rtable *r, **rp; unsigned long flags; @@ -82,7 +83,9 @@ static void rt_del(unsigned long dst) cli(); while((r = *rp) != NULL) { - if (r->rt_dst != dst) + /* Make sure both the destination and the device match */ + if ( r->rt_dst != dst || + (devname != NULL && strcmp((r->rt_dev)->name,devname) != 0) ) { rp = &r->rt_next; continue; @@ -467,9 +470,19 @@ static int rt_new(struct rtentry *r) static int rt_kill(struct rtentry *r) { struct sockaddr_in *trg; + char *devname; + int err; trg = (struct sockaddr_in *) &r->rt_dst; - rt_del(trg->sin_addr.s_addr); + if ((devname = r->rt_dev) != NULL) + { + err = getname(devname, &devname); + if (err) + return err; + } + rt_del(trg->sin_addr.s_addr, devname); + if ( devname != NULL ) + putname(devname); return 0; } diff --git a/net/inet/udp.c b/net/inet/udp.c index 1a8316b173a3..49dadf4229ea 100644 --- a/net/inet/udp.c +++ b/net/inet/udp.c @@ -563,9 +563,9 @@ int udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, struct sock *sk; struct udphdr *uh; unsigned short ulen; - int addr_type=IS_MYADDR; + int addr_type = IS_MYADDR; - if(skb->dev->pa_addr!=daddr) + if(!dev || dev->pa_addr!=daddr) addr_type=ip_chk_addr(daddr); /* @@ -621,7 +621,7 @@ int udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, else skb1=skb; if(skb1) - udp_deliver(sk, uh, skb1,skb->dev,saddr,daddr,len); + udp_deliver(sk, uh, skb1, dev,saddr,daddr,len); sk=sknext; } while(sknext!=NULL); @@ -648,7 +648,7 @@ int udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt, return(0); } - return udp_deliver(sk,uh,skb,skb->dev, saddr, daddr, len); + return udp_deliver(sk,uh,skb,dev, saddr, daddr, len); } static int udp_deliver(struct sock *sk, struct udphdr *uh, struct sk_buff *skb, struct device *dev, long saddr, long daddr, int len) -- 2.39.5