From f8364eef9384418d3e2456eeb92492d7d6fdce65 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 23 Nov 2007 15:21:08 -0500 Subject: [PATCH] Import 2.2.15pre18 --- Makefile | 2 +- arch/alpha/kernel/alpha_ksyms.c | 1 + arch/alpha/kernel/smc37c669.c | 3 ++ arch/alpha/kernel/smp.c | 21 +++++++- arch/alpha/mm/extable.c | 2 +- drivers/block/ide-pci.c | 2 +- drivers/net/eepro100.c | 2 +- drivers/net/rtl8139.c | 9 ++++ include/asm-alpha/pgtable.h | 21 ++++++-- include/linux/sysctl.h | 3 +- include/net/br.h | 2 +- masq.patch | 96 +++++++++++++++++++++++++++++++++ net/appletalk/aarp.c | 9 ++-- net/ipv4/ip_masq.c | 34 ++++++++---- net/ipv4/sysctl_net_ipv4.c | 3 ++ 15 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 masq.patch diff --git a/Makefile b/Makefile index 2d6eb92e5caf..d9a9a9c635f6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 2 SUBLEVEL = 15 -EXTRAVERSION = pre17 +EXTRAVERSION = pre18 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c index 52206c5d0f0e..6c87516116bc 100644 --- a/arch/alpha/kernel/alpha_ksyms.c +++ b/arch/alpha/kernel/alpha_ksyms.c @@ -160,6 +160,7 @@ EXPORT_SYMBOL(flush_tlb_all); EXPORT_SYMBOL(flush_tlb_mm); EXPORT_SYMBOL(flush_tlb_page); EXPORT_SYMBOL(flush_tlb_range); +EXPORT_SYMBOL(smp_imb); EXPORT_SYMBOL(cpu_data); EXPORT_SYMBOL(cpu_number_map); EXPORT_SYMBOL(global_bh_lock); diff --git a/arch/alpha/kernel/smc37c669.c b/arch/alpha/kernel/smc37c669.c index caab7accc292..0b2db18ab34c 100644 --- a/arch/alpha/kernel/smc37c669.c +++ b/arch/alpha/kernel/smc37c669.c @@ -2588,6 +2588,9 @@ void __init SMC669_Init ( int index ) ); SMC37c669_enable_device( FLOPPY_0 ); + /* Wake up sometimes forgotten floppy, especially on DP264. */ + outb(0xc, 0x3f2); + SMC37c669_disable_device( IDE_0 ); #if SMC_DEBUG diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index e448d384066e..65ec8ce4b5e1 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -348,7 +348,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle) hwpcb->res1 = hwpcb->res2 = 0; DBGS(("KSP 0x%lx PTBR 0x%lx VPTBR 0x%lx UNIQUE 0x%lx\n", - hwpcb->ksp, hwpcb->ptbr, hwrpb->vptb, hwcpb->unique)); + hwpcb->ksp, hwpcb->ptbr, hwrpb->vptb, hwpcb->unique)); DBGS(("Starting secondary cpu %d: state 0x%lx pal_flags 0x%lx\n", cpuid, idle->state, idle->tss.pal_flags)); @@ -704,7 +704,7 @@ handle_ipi(struct pt_regs *regs) unsigned long *pending_ipis = &ipi_data[this_cpu].bits; unsigned long ops; - DBGS(("handle_ipi: on CPU %d ops 0x%x PC 0x%lx\n", + DBGS(("handle_ipi: on CPU %d ops 0x%lx PC 0x%lx\n", this_cpu, *pending_ipis, regs->pc)); mb(); /* Order interrupt and bit testing. */ @@ -838,6 +838,23 @@ smp_call_function (void (*func) (void *info), void *info, int retry, int wait) return 0; } +static void +ipi_imb(void *ignored) +{ + imb(); +} + +void +smp_imb(void) +{ + /* Must wait for other processors to flush their icache + before continuing. */ + if (smp_call_function(ipi_imb, NULL, 1, 1)) + printk(KERN_CRIT "smp_imb: timed out\n"); + + imb(); +} + static void ipi_flush_tlb_all(void *ignored) { diff --git a/arch/alpha/mm/extable.c b/arch/alpha/mm/extable.c index 12a1f4803fd1..b0cb627ad697 100644 --- a/arch/alpha/mm/extable.c +++ b/arch/alpha/mm/extable.c @@ -41,7 +41,7 @@ search_exception_table(unsigned long addr) { unsigned ret; -#ifndef CONFIG_MODULE +#ifndef CONFIG_MODULES /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table - 1, addr - gp); diff --git a/drivers/block/ide-pci.c b/drivers/block/ide-pci.c index 71d4801188a0..7455f03557b3 100644 --- a/drivers/block/ide-pci.c +++ b/drivers/block/ide-pci.c @@ -245,7 +245,7 @@ __initfunc(static ide_hwif_t *ide_match_hwif (unsigned long io_base, byte bootab return hwif; /* pick an unused entry */ } } - for (h = 0; h < 2; ++h) { + for (h = 0; h < ((MAX_HWIFS >= 2) ? 2 : MAX_HWIFS); ++h) { hwif = ide_hwifs + h; if (hwif->chipset == ide_unknown) return hwif; /* pick an unused entry */ diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index eefbcbac5ed6..5b6cad4254aa 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -335,7 +335,7 @@ struct pci_id_info { Typically this takes 0 ticks. */ static inline void wait_for_cmd_done(long cmd_ioaddr) { - int wait = 100; + int wait = 1000; do ; while(inb(cmd_ioaddr) && --wait >= 0); } diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c index c2da78a17f0d..710e1d345c81 100644 --- a/drivers/net/rtl8139.c +++ b/drivers/net/rtl8139.c @@ -1136,6 +1136,15 @@ static void rtl8129_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if (status & (PCSTimeout)) tp->stats.rx_length_errors++; if (status & (RxUnderrun|RxFIFOOver)) tp->stats.rx_fifo_errors++; + + if (status & RxFIFOOver) { + tp->cur_rx = 0; + outb(CmdTxEnb, ioaddr + ChipCmd); + outb(CmdRxEnb | CmdTxEnb, ioaddr + ChipCmd); + outl((RX_FIFO_THRESH << 13) | (RX_BUF_LEN_IDX << 11) | + (RX_DMA_BURST<<8), ioaddr + RxConfig); + } + if (status & RxOverflow) { tp->stats.rx_over_errors++; tp->cur_rx = inw(ioaddr + RxBufAddr) % RX_BUF_LEN; diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 41ced4b6cbf7..889737c82494 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -17,14 +17,29 @@ #include /* For the task lock */ -/* Caches aren't brain-dead on the Alpha. */ -#define flush_cache_all() do { } while (0) +/* The icache is not coherent with the dcache on an Alpha, thus before + running self modified code we must always issue an imb(). Actually + flush_cache_all() is real overkill as it's recalled from vmalloc() before + accessing pagetables and on the Alpha we are not required to flush the + icache before doing that, but the semantic of flush_cache_all() requires + us to flush _all_ the caches and so we must be correct here. It's instead + vmalloc that should be changed to use a more finegrained cache flush + operation (I suspect that also other archs doesn't need an icache flush + while handling pagetables). OTOH vmalloc is not a performance critical + path so after all we can live with it for now. */ + +#define flush_cache_all() flush_icache_range(0, 0) #define flush_cache_mm(mm) do { } while (0) #define flush_cache_range(mm, start, end) do { } while (0) #define flush_cache_page(vma, vmaddr) do { } while (0) #define flush_page_to_ram(page) do { } while (0) -#define flush_icache_range(start, end) do { } while (0) #define flush_dcache_page(page) do { } while (0) +#ifndef __SMP__ +#define flush_icache_range(start, end) imb() +#else +#define flush_icache_range(start, end) smp_imb() +extern void smp_imb(void); +#endif /* * Use a few helper functions to hide the ugly broken ASN diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 00bebabefd75..d4abfc53a8d5 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -227,7 +227,8 @@ enum NET_IPV4_ICMP_ECHOREPLY_RATE=63, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, - NET_IPV4_ALWAYS_DEFRAG=67 + NET_IPV4_ALWAYS_DEFRAG=67, + NET_IPV4_IP_MASQ_UDP_DLOOSE=68 }; enum { diff --git a/include/net/br.h b/include/net/br.h index cbf4b4c3c472..c88681fbaf0f 100644 --- a/include/net/br.h +++ b/include/net/br.h @@ -50,7 +50,7 @@ #define HOLD_TIME 1 /* broacast/multicast storm limitation. This per source. */ -#define MAX_MCAST_PER_PERIOD 4 +#define MAX_MCAST_PER_PERIOD 32 #define MCAST_HOLD_TIME (10*HZ/100) #define Default_path_cost 10 diff --git a/masq.patch b/masq.patch new file mode 100644 index 000000000000..7881f1e85208 --- /dev/null +++ b/masq.patch @@ -0,0 +1,96 @@ +# This is a patch for linux-2.2.15pre16 to update it to linux-2.2.15pre16.masq +# +# To apply this patch: +# STEP 1: Chdir to the source directory. +# STEP 2: Run the 'applypatch' program with this patch file as input. +# +# If you do not have 'applypatch', it is part of the 'makepatch' package +# that you can fetch from the Comprehensive Perl Archive Network: +# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz +# In the above URL, 'x' should be 2 or higher. +# +# To apply this patch without the use of 'applypatch': +# STEP 1: Chdir to the source directory. +# STEP 2: Run the 'patch' program with this file as input. +# +#### End of Preamble #### + +#### Patch data follows #### +diff -u 'linux-2.2.15pre16/Documentation/Configure.help' 'linux-2.2.15pre16.masq/Documentation/Configure.help' +Index: ./Documentation/Configure.help +--- ./Documentation/Configure.help Fri Mar 31 09:34:45 2000 ++++ ./Documentation/Configure.help Fri Mar 31 09:50:34 2000 +@@ -2550,6 +2550,20 @@ + kernel whenever you want; read Documentation/modules.txt for + details. + ++IP: UDP masquerading loose checking ++CONFIG_IP_MASQUERADE_UDP_LOOSE ++ Whether UDP masquerading does address checking in a loose fashion. ++ ++ If you say Y here, then UDP masqueraded connections will allow ++ any external system to be connect back through the firewall to the ++ port on the internal machine. However it will allow the more ++ efficient use of masqueraded ports, and may be required for some ++ gaming uses. ++ ++ You should only say Y here if you understand the consequences since ++ it will open your internal network to external probing and potential ++ attacks. In all other cases choose N ++ + IP: ICMP masquerading + CONFIG_IP_MASQUERADE_ICMP + The basic masquerade code described for "IP: masquerading" above +diff -u 'linux-2.2.15pre16/net/ipv4/Config.in' 'linux-2.2.15pre16.masq/net/ipv4/Config.in' +Index: ./net/ipv4/Config.in +--- ./net/ipv4/Config.in Fri Mar 31 09:34:03 2000 ++++ ./net/ipv4/Config.in Fri Mar 31 09:52:26 2000 +@@ -41,6 +41,7 @@ + bool 'IP: masquerading' CONFIG_IP_MASQUERADE + if [ "$CONFIG_IP_MASQUERADE" != "n" ]; then + comment 'Protocol-specific masquerading support will be built as modules.' ++ bool 'IP: UDP masquerading loose checking' CONFIG_IP_MASQUERADE_UDP_LOOSE + bool 'IP: ICMP masquerading' CONFIG_IP_MASQUERADE_ICMP + comment 'Protocol-specific masquerading support will be built as modules.' + if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then +diff -u 'linux-2.2.15pre16/net/ipv4/ip_masq.c' 'linux-2.2.15pre16.masq/net/ipv4/ip_masq.c' +Index: ./net/ipv4/ip_masq.c +Prereq: 1.34.2.2 +--- ./net/ipv4/ip_masq.c Fri Mar 31 09:34:19 2000 ++++ ./net/ipv4/ip_masq.c Fri Mar 31 14:38:17 2000 +@@ -412,12 +412,6 @@ + #define MASQ_DPORT_PASS (IP_MASQ_F_NO_DPORT|IP_MASQ_F_DLOOSE) + + /* +- * By default enable dest loose semantics +- */ +-#define CONFIG_IP_MASQ_LOOSE_DEFAULT 1 +- +- +-/* + * Set masq expiration (deletion) and adds timer, + * if timeout==0 cancel expiration. + * Warning: it does not check/delete previous timer! +@@ -937,7 +931,7 @@ + atomic_set(&ms->refcnt,0); + + if (proto == IPPROTO_UDP && !mport) +-#ifdef CONFIG_IP_MASQ_LOOSE_DEFAULT ++#ifdef CONFIG_IP_MASQUERADE_UDP_LOOSE + /* + * Flag this tunnel as "dest loose" + * +#### End of Patch data #### + +#### ApplyPatch data follows #### +# Data version : 1.0 +# Date generated : Fri Mar 31 14:38:26 2000 +# Generated by : makepatch 2.00 +# Recurse directories : Yes +# p 'Documentation/Configure.help' 565235 954492634 0100644 +# p 'net/ipv4/Config.in' 3618 954492746 0100644 +# p 'net/ipv4/ip_masq.c' 65999 954509897 0100644 +#### End of ApplyPatch data #### + +#### End of Patch kit [created: Fri Mar 31 14:38:26 2000] #### +#### Checksum: 95 3735 33457 #### diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 79c6c7e457ef..9adc87493108 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -814,6 +814,7 @@ static int aarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type unsigned long flags; int hash; struct atalk_iface *ifa; + int func; /* @@ -836,13 +837,13 @@ static int aarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type return 0; } - ea->function=ntohs(ea->function); + func=ntohs(ea->function); /* * Sanity check fields. */ - if(ea->functionfunction > AARP_PROBE || ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN || + if(func AARP_PROBE || ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN || ea->pa_src_zero != 0 || ea->pa_dst_zero != 0) { kfree_skb(skb); @@ -920,7 +921,7 @@ static int aarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type return 1; } - switch(ea->function) + switch(func) { case AARP_REPLY: if(unresolved_count==0) /* Speed up */ @@ -977,7 +978,7 @@ static int aarp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type ma = &da; } - if(ea->function==AARP_PROBE) + if(func==AARP_PROBE) { /* A probe implies someone trying to get an address. So as a precaution flush any diff --git a/net/ipv4/ip_masq.c b/net/ipv4/ip_masq.c index df8186cc6768..8d42ea8608c6 100644 --- a/net/ipv4/ip_masq.c +++ b/net/ipv4/ip_masq.c @@ -74,6 +74,7 @@ #include #include #include +#include #include #ifdef CONFIG_IP_MASQUERADE_MOD @@ -85,6 +86,7 @@ #include int sysctl_ip_masq_debug = 0; +int sysctl_ip_masq_udp_dloose = 0; /* * Exported wrapper @@ -930,17 +932,29 @@ struct ip_masq * ip_masq_new(int proto, __u32 maddr, __u16 mport, __u32 saddr, _ atomic_set(&ms->n_control,0); atomic_set(&ms->refcnt,0); - if (proto == IPPROTO_UDP && !mport) -#ifdef CONFIG_IP_MASQUERADE_UDP_LOOSE - /* - * Flag this tunnel as "dest loose" - * - */ - ms->flags |= IP_MASQ_F_DLOOSE; -#else - ms->flags |= IP_MASQ_F_NO_DADDR; -#endif + if (proto == IPPROTO_UDP && !mport) { + switch( sysctl_ip_masq_udp_dloose ) { + case 2: + /* + * Flag this tunnel as "dest loose" + * + */ + ms->flags |= IP_MASQ_F_DLOOSE; + break; + case 1: + if( ntohs(sport) < PROT_SOCK ) { + ms->flags |= IP_MASQ_F_NO_DADDR; + } + else { + ms->flags |= IP_MASQ_F_DLOOSE; + } + break; + default: + ms->flags |= IP_MASQ_F_NO_DADDR; + break; + } + } /* get masq address from rif */ ms->maddr = maddr; diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 235b36d15a89..fa4dc0912a11 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -46,6 +46,7 @@ extern int sysctl_ip_always_defrag; /* From ip_masq.c */ extern int sysctl_ip_masq_debug; +extern int sysctl_ip_masq_udp_dloose; extern int sysctl_tcp_timestamps; extern int sysctl_tcp_window_scaling; @@ -149,6 +150,8 @@ ctl_table ipv4_table[] = { #ifdef CONFIG_IP_MASQUERADE {NET_IPV4_IP_MASQ_DEBUG, "ip_masq_debug", &sysctl_ip_masq_debug, sizeof(int), 0644, NULL, &proc_dointvec}, + {NET_IPV4_IP_MASQ_UDP_DLOOSE, "ip_masq_udp_dloose", + &sysctl_ip_masq_udp_dloose, sizeof(int), 0644, NULL, &proc_dointvec}, #endif {NET_IPV4_IPFRAG_TIME, "ipfrag_time", &sysctl_ipfrag_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies, -- 2.39.5