diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
commit | f9bbe9da79dbc8557c74efeb158b431cd67ace52 (patch) | |
tree | 3220d014a35f9d88a48668a1468524e988daebff /include | |
parent | 3d697109c1ff85ef563aec3d5e113ef225ed2792 (diff) |
Upgrade to 2.1.73.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/math_emu.h | 14 | ||||
-rw-r--r-- | include/asm-i386/processor.h | 5 | ||||
-rw-r--r-- | include/asm-i386/ptrace.h | 6 | ||||
-rw-r--r-- | include/asm-i386/system.h | 22 | ||||
-rw-r--r-- | include/linux/blkdev.h | 2 | ||||
-rw-r--r-- | include/linux/dmascc.h | 43 | ||||
-rw-r--r-- | include/linux/fs.h | 5 | ||||
-rw-r--r-- | include/linux/hdreg.h | 4 | ||||
-rw-r--r-- | include/linux/ip_fw.h | 26 | ||||
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 1 | ||||
-rw-r--r-- | include/linux/pci.h | 4 | ||||
-rw-r--r-- | include/linux/proc_fs.h | 5 | ||||
-rw-r--r-- | include/linux/smb_fs.h | 17 | ||||
-rw-r--r-- | include/linux/socket.h | 2 | ||||
-rw-r--r-- | include/linux/sysctl.h | 2 | ||||
-rw-r--r-- | include/net/ip_autofw.h | 33 | ||||
-rw-r--r-- | include/net/ip_masq.h | 224 | ||||
-rw-r--r-- | include/net/ip_masq_mod.h | 78 | ||||
-rw-r--r-- | include/net/ip_portfw.h | 29 | ||||
-rw-r--r-- | include/net/llc.h | 7 | ||||
-rw-r--r-- | include/net/tcp.h | 50 |
22 files changed, 513 insertions, 67 deletions
diff --git a/include/asm-i386/math_emu.h b/include/asm-i386/math_emu.h index d1b0134cc..7284939fe 100644 --- a/include/asm-i386/math_emu.h +++ b/include/asm-i386/math_emu.h @@ -3,17 +3,8 @@ #include <asm/sigcontext.h> -void restore_i387_soft(struct _fpstate *buf); -struct _fpstate * save_i387_soft(struct _fpstate * buf); - -struct fpu_reg { - char sign; - char tag; - long exp; - unsigned sigl; - unsigned sigh; -}; - +void restore_i387_soft(void *s387, struct _fpstate *buf); +struct _fpstate * save_i387_soft(void *s387, struct _fpstate * buf); /* This structure matches the layout of the data saved to the stack following a device-not-present interrupt, part of it saved @@ -42,5 +33,4 @@ struct info { long ___vm86_fs; long ___vm86_gs; }; - #endif diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 449caf768..9e4ca405d 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -76,9 +76,8 @@ struct i387_soft_struct { long fcs; long foo; long fos; - long top; - struct fpu_reg regs[8]; /* 8*16 bytes for each FP-reg = 128 bytes */ - unsigned char lookahead; + long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ + unsigned char ftop, changed, lookahead, no_update, rm, alimit; struct info *info; unsigned long entry_eip; }; diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h index 90aa9a55e..985d28829 100644 --- a/include/asm-i386/ptrace.h +++ b/include/asm-i386/ptrace.h @@ -41,6 +41,12 @@ struct pt_regs { int xss; }; +/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 + #ifdef __KERNEL__ #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs)) #define instruction_pointer(regs) ((regs)->eip) diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 145118a71..738268052 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -275,22 +275,20 @@ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ ((limit) & 0x0ffff); } #define _set_tssldt_desc(n,addr,limit,type) \ -__asm__ __volatile__ ("movw $" #limit ",%1\n\t" \ - "movw %%ax,%2\n\t" \ +__asm__ __volatile__ ("movw %3,0(%2)\n\t" \ + "movw %%ax,2(%2)\n\t" \ "rorl $16,%%eax\n\t" \ - "movb %%al,%3\n\t" \ - "movb $" type ",%4\n\t" \ - "movb $0x00,%5\n\t" \ - "movb %%ah,%6\n\t" \ + "movb %%al,4(%2)\n\t" \ + "movb %4,5(%2)\n\t" \ + "movb $0,6(%2)\n\t" \ + "movb %%ah,7(%2)\n\t" \ "rorl $16,%%eax" \ - : /* no output */ \ - :"a" (addr), "m" (*(n)), "m" (*(n+2)), "m" (*(n+4)), \ - "m" (*(n+5)), "m" (*(n+6)), "m" (*(n+7)) \ - ) + : "=m"(*(n)) : "a" (addr), "r"(n), "i"(limit), "i"(type)) -#define set_tss_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),235,"0x89") +#define set_tss_desc(n,addr) \ + _set_tssldt_desc(((char *) (n)),((int)(addr)),235,0x89) #define set_ldt_desc(n,addr,size) \ - _set_tssldt_desc(((char *) (n)),((int)(addr)),((size << 3) - 1),"0x82") + _set_tssldt_desc(((char *) (n)),((int)(addr)),((size << 3) - 1),0x82) /* * This is the ldt that every process will get unless we need diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9bad95386..1e7005e6c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -70,4 +70,6 @@ extern int * hardsect_size[MAX_BLKDEV]; extern int * max_readahead[MAX_BLKDEV]; +extern int * max_sectors[MAX_BLKDEV]; + #endif diff --git a/include/linux/dmascc.h b/include/linux/dmascc.h index 01b46df73..a30d84e60 100644 --- a/include/linux/dmascc.h +++ b/include/linux/dmascc.h @@ -41,3 +41,46 @@ struct scc_param { int dma; /* 1, 3 */ }; +/* + * $Id: dmascc.h,v 1.1 1997/12/01 10:44:55 oe1kib Exp $ + * + * Driver for high-speed SCC boards (those with DMA support) + * Copyright (C) 1997 Klaus Kudielka + * + * 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. + */ + +/* Ioctls */ +#define SIOCGSCCPARAM SIOCDEVPRIVATE +#define SIOCSSCCPARAM (SIOCDEVPRIVATE+1) + +/* Frequency of timer 0 */ +#define TMR_0_HZ 25600 + +/* Configurable parameters */ +struct scc_param { + int pclk_hz; /* frequency of BRG input (read-only - don't change) */ + int brg_tc; /* baud rate generator terminal count - BRG disabled if < 0 */ + int nrzi; /* 0 (nrz), 1 (nrzi) */ + int clocks; /* see documentation */ + int txdelay; /* [1/TMR_0_HZ] */ + int txtime; /* [1/HZ] */ + int sqdelay; /* [1/TMR_0_HZ] */ + int waittime; /* [1/TMR_0_HZ] */ + int slottime; /* [1/TMR_0_HZ] */ + int persist; /* 0 ... 255 */ + int dma; /* 1, 3 */ +}; + diff --git a/include/linux/fs.h b/include/linux/fs.h index 28b6f1e50..4c2bcd91c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -138,6 +138,10 @@ extern int max_files, nr_files, nr_free_files; #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ #define BLKRASET _IO(0x12,98) /* Set read ahead for block device */ #define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ #define FIBMAP _IO(0x00,1) /* bmap access */ @@ -713,6 +717,7 @@ extern void put_write_access(struct inode *inode); extern struct dentry * open_namei(const char * pathname, int flag, int mode); extern struct dentry * do_mknod(const char * filename, int mode, dev_t dev); extern int do_pipe(int *); +extern ino_t find_inode_number(struct dentry *, struct qstr *); /* * Kernel pointers have redundant information, so we can use a diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index cedbd1e2c..35db77dc9 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -195,10 +195,6 @@ struct hd_driveid { void hd_setup(char *, int *); #endif /* CONFIG_BLK_DEV_HD */ -#ifdef CONFIG_BLK_DEV_IDE -void ide_setup(char *); -#endif /* CONFIG_BLK_DEV_IDE */ - #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) int ide_register(int io_port, int ctl_port, int irq); void ide_unregister(unsigned int); diff --git a/include/linux/ip_fw.h b/include/linux/ip_fw.h index 0b6c103f1..a9933659c 100644 --- a/include/linux/ip_fw.h +++ b/include/linux/ip_fw.h @@ -126,7 +126,8 @@ struct ip_fw #define IP_FW_IN 1 #define IP_FW_OUT 2 #define IP_FW_ACCT 3 -#define IP_FW_CHAINS 4 /* total number of ip_fw chains */ +#define IP_FW_MASQ 4 +#define IP_FW_CHAINS 5 /* total number of ip_fw chains */ #define IP_FW_INSERT (IP_FW_BASE_CTL) #define IP_FW_APPEND (IP_FW_BASE_CTL+1) @@ -167,6 +168,11 @@ struct ip_fw #define IP_ACCT_FLUSH (IP_FW_FLUSH | (IP_FW_ACCT << IP_FW_SHIFT)) #define IP_ACCT_ZERO (IP_FW_ZERO | (IP_FW_ACCT << IP_FW_SHIFT)) +#define IP_FW_MASQ_INSERT (IP_FW_INSERT | (IP_FW_MASQ << IP_FW_SHIFT)) +#define IP_FW_MASQ_ADD (IP_FW_APPEND | (IP_FW_MASQ << IP_FW_SHIFT)) +#define IP_FW_MASQ_DEL (IP_FW_DELETE | (IP_FW_MASQ << IP_FW_SHIFT)) +#define IP_FW_MASQ_FLUSH (IP_FW_FLUSH | (IP_FW_MASQ << IP_FW_SHIFT)) + struct ip_fwpkt { struct iphdr fwp_iph; /* IP header */ @@ -179,6 +185,20 @@ struct ip_fwpkt char fwp_vianame[IFNAMSIZ]; /* interface name */ }; +#define IP_FW_MASQCTL_MAX 256 +#define IP_MASQ_MOD_NMAX 32 + +struct ip_fw_masqctl +{ + int mctl_action; + union { + struct { + char name[IP_MASQ_MOD_NMAX]; + char data[1]; + } mod; + } u; +}; + /* * timeouts for ip masquerading */ @@ -211,9 +231,13 @@ extern int ip_fw_ctl(int, void *, int); extern struct ip_fw *ip_acct_chain; extern int ip_acct_ctl(int, void *, int); #endif +#ifdef CONFIG_IP_MASQUERADE +extern int ip_masq_ctl(int, void *, int); +#endif extern int ip_fw_chk(struct iphdr *, struct device *, __u16 *, struct ip_fw *, int, int); extern void ip_fw_init(void); #endif /* KERNEL */ + #endif /* _IP_FW_H */ diff --git a/include/linux/mm.h b/include/linux/mm.h index 276c27960..4a44f193d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -144,7 +144,6 @@ typedef struct page { #define PageLocked(page) (test_bit(PG_locked, &(page)->flags)) #define PageError(page) (test_bit(PG_error, &(page)->flags)) #define PageReferenced(page) (test_bit(PG_referenced, &(page)->flags)) -#define PageDirty(page) (test_bit(PG_dirty, &(page)->flags)) #define PageUptodate(page) (test_bit(PG_uptodate, &(page)->flags)) #define PageFreeAfter(page) (test_bit(PG_free_after, &(page)->flags)) #define PageDecrAfter(page) (test_bit(PG_decr_after, &(page)->flags)) diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index e233695c0..3c869e38d 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -168,6 +168,7 @@ extern int nfs_lock(struct file *file, int cmd, struct file_lock *fl); * linux/fs/nfs/write.c */ extern int nfs_writepage(struct inode *, struct page *); +extern int nfs_check_failed_request(struct inode *); extern int nfs_check_error(struct inode *); extern int nfs_flush_dirty_pages(struct inode *, pid_t, off_t, off_t); extern int nfs_truncate_dirty_pages(struct inode *, unsigned long); diff --git a/include/linux/pci.h b/include/linux/pci.h index 164a32768..d242a9912 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -789,8 +789,8 @@ #define PCI_DEVICE_ID_INTEL_82865 0x1227 #define PCI_DEVICE_ID_INTEL_82557 0x1229 #define PCI_DEVICE_ID_INTEL_82437 0x122d -#define PCI_DEVICE_ID_INTEL_82371_0 0x122e -#define PCI_DEVICE_ID_INTEL_82371_1 0x1230 +#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e +#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 #define PCI_DEVICE_ID_INTEL_82371MX 0x1234 #define PCI_DEVICE_ID_INTEL_82437MX 0x1235 #define PCI_DEVICE_ID_INTEL_82441 0x1237 diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 902e63f39..2d2a7453e 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -248,6 +248,11 @@ struct proc_dir_entry { int deleted; /* delete flag */ }; +typedef int (read_proc_t)(char *page, char **start, off_t off, + int count, int *eof, void *data); +typedef int (write_proc_t)(struct file *file, const char *buffer, + unsigned long count, void *data); + extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, off_t offset, int length, int inout); diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h index d34e9d77d..f21d66080 100644 --- a/include/linux/smb_fs.h +++ b/include/linux/smb_fs.h @@ -106,22 +106,23 @@ __u8 *smb_encode_smb_length(__u8 *, __u32); __u8 *smb_setup_header(struct smb_sb_info *, __u8, __u16, __u16); int smb_get_rsize(struct smb_sb_info *); int smb_get_wsize(struct smb_sb_info *); -int smb_offerconn(struct smb_sb_info *); int smb_newconn(struct smb_sb_info *, struct smb_conn_opt *); +int smb_errno(struct smb_sb_info *); int smb_close(struct inode *); void smb_close_dentry(struct dentry *); int smb_close_fileid(struct dentry *, __u16); int smb_open(struct dentry *, int); int smb_proc_read(struct inode *, off_t, int, char *); int smb_proc_write(struct inode *, off_t, int, const char *); -int smb_proc_create(struct dentry *, struct qstr *, __u16, time_t, __u16 *); -int smb_proc_mv(struct dentry *, struct qstr *, struct dentry *, struct qstr *); -int smb_proc_mkdir(struct dentry *, struct qstr *); -int smb_proc_rmdir(struct dentry *, struct qstr *); -int smb_proc_unlink(struct dentry *dir, struct qstr *); +int smb_proc_create(struct dentry *, __u16, time_t, __u16 *); +int smb_proc_mv(struct dentry *, struct dentry *); +int smb_proc_mkdir(struct dentry *); +int smb_proc_rmdir(struct dentry *); +int smb_proc_unlink(struct dentry *); int smb_proc_readdir(struct dentry *, int, void *); -int smb_proc_getattr(struct dentry *, struct qstr *, struct smb_fattr *); -int smb_proc_setattr(struct smb_sb_info *, struct dentry *, struct smb_fattr *); +int smb_proc_getattr(struct dentry *, struct smb_fattr *); +int smb_proc_setattr(struct dentry *, struct smb_fattr *); +int smb_proc_settime(struct dentry *, struct smb_fattr *); int smb_proc_dskattr(struct super_block *, struct statfs *); int smb_proc_reconnect(struct smb_sb_info *); int smb_proc_connect(struct smb_sb_info *); diff --git a/include/linux/socket.h b/include/linux/socket.h index 86d2b5665..e274a3c51 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -221,7 +221,7 @@ extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, extern int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset, - int len, int *csump); + unsigned int len, int *csump); extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 1f9ab2bf8..68b6fee1b 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -173,6 +173,8 @@ enum NET_IPV4_IGMP_MAX_HOST_REPORT_DELAY, NET_IPV4_IGMP_TIMER_SCALE, NET_IPV4_IGMP_AGE_THRESHOLD, + NET_IPV4_IP_DYNADDR, + NET_IPV4_IP_MASQ_DEBUG, NET_TCP_SYNCOOKIES, NET_TCP_STDURG, NET_TCP_SYN_TAILDROP, diff --git a/include/net/ip_autofw.h b/include/net/ip_autofw.h new file mode 100644 index 000000000..feeec7bb1 --- /dev/null +++ b/include/net/ip_autofw.h @@ -0,0 +1,33 @@ +#include <linux/types.h> +#include <linux/kernel.h> + +#ifndef _IP_AUTOFW_H +#define _IP_AUTOFW_H + +#define IP_AUTOFW_EXPIRE 15*HZ + +#define IP_FWD_RANGE 1 +#define IP_FWD_PORT 2 +#define IP_FWD_DIRECT 3 + +#define IP_AUTOFW_ACTIVE 1 +#define IP_AUTOFW_USETIME 2 +#define IP_AUTOFW_SECURE 4 + +struct ip_autofw { + struct ip_autofw * next; + __u16 type; + __u16 low; + __u16 hidden; + __u16 high; + __u16 visible; + __u16 protocol; + __u32 lastcontact; + __u32 where; + __u16 ctlproto; + __u16 ctlport; + __u16 flags; + struct timer_list timer; +}; +int ip_autofw_init(void); +#endif /* _IP_AUTOFW_H */ diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h index 4a0b10a55..810abd5f6 100644 --- a/include/net/ip_masq.h +++ b/include/net/ip_masq.h @@ -5,9 +5,23 @@ #ifndef _IP_MASQ_H #define _IP_MASQ_H +#ifdef __KERNEL__ #include <linux/types.h> #include <linux/netdevice.h> +#include <linux/ip.h> #include <linux/skbuff.h> +#endif /* __KERNEL__ */ + +/* + * This define affects the number of ports that can be handled + * by each of the protocol helper modules. + */ +#define MAX_MASQ_APP_PORTS 12 + +/* + * Linux ports don't normally get allocated above 32K. + * I used an extra 4K port-space + */ /* * Linux ports don't normally get allocated above 32K. @@ -20,18 +34,21 @@ #define MASQUERADE_EXPIRE_TCP 15*60*HZ #define MASQUERADE_EXPIRE_TCP_FIN 2*60*HZ #define MASQUERADE_EXPIRE_UDP 5*60*HZ +/* + * ICMP can no longer be modified on the fly using an ioctl - this + * define is the only way to change the timeouts + */ +#define MASQUERADE_EXPIRE_ICMP 125*HZ #define IP_MASQ_F_OUT_SEQ 0x01 /* must do output seq adjust */ #define IP_MASQ_F_IN_SEQ 0x02 /* must do input seq adjust */ -#define IP_MASQ_F_NO_DPORT 0x04 /* no dport set yet */ -#define IP_MASQ_F_NO_DADDR 0x08 /* no daddr yet */ -#define IP_MASQ_F_HASHED 0x10 /* hashed entry */ -#define IP_MASQ_F_SAW_RST 0x20 /* tcp rst pkt seen */ -#define IP_MASQ_F_SAW_FIN_IN 0x40 /* tcp fin pkt seen incoming */ -#define IP_MASQ_F_SAW_FIN_OUT 0x80 /* tcp fin pkt seen outgoing */ -#define IP_MASQ_F_SAW_FIN (IP_MASQ_F_SAW_FIN_IN | \ - IP_MASQ_F_SAW_FIN_OUT) - /* tcp fin pkts seen */ +#define IP_MASQ_F_NO_DPORT 0x04 /* no dport set yet */ +#define IP_MASQ_F_NO_DADDR 0x08 /* no daddr yet */ +#define IP_MASQ_F_HASHED 0x10 /* hashed entry */ + +#define IP_MASQ_F_NO_SPORT 0x200 /* no sport set yet */ +#define IP_MASQ_F_NO_REPLY 0x800 /* no reply yet from outside */ +#define IP_MASQ_F_MPORT 0x1000 /* own mport specified */ #ifdef __KERNEL__ @@ -51,6 +68,7 @@ struct ip_masq_seq { */ struct ip_masq { struct ip_masq *m_link, *s_link; /* hashed link ptrs */ + atomic_t refcnt; /* reference count */ struct timer_list timer; /* Expiration timer */ __u16 protocol; /* Which protocol are we talking? */ __u16 sport, dport, mport; /* src, dst & masq ports */ @@ -58,7 +76,12 @@ struct ip_masq { struct ip_masq_seq out_seq, in_seq; struct ip_masq_app *app; /* bound ip_masq_app object */ void *app_data; /* Application private data */ - unsigned flags; /* status flags */ + struct ip_masq *control; /* Master control connection */ + atomic_t n_control; /* Number of "controlled" masqs */ + unsigned flags; /* status flags */ + unsigned timeout; /* timeout */ + unsigned state; /* state info */ + struct ip_masq_timeout_table *timeout_table; }; /* @@ -76,9 +99,10 @@ extern struct ip_fw_masq *ip_masq_expire; /* * [0]: UDP free_ports * [1]: TCP free_ports + * [2]: ICMP free_ports */ -extern int ip_masq_free_ports[2]; +extern atomic_t ip_masq_free_ports[3]; /* * ip_masq initializer (registers symbols and /proc/net entries) @@ -89,14 +113,17 @@ extern int ip_masq_init(void); * functions called from ip layer */ extern int ip_fw_masquerade(struct sk_buff **, __u32 maddr); -extern int ip_fw_masq_icmp(struct sk_buff **); +extern int ip_fw_masq_icmp(struct sk_buff **, __u32 maddr); extern int ip_fw_demasquerade(struct sk_buff **); /* * ip_masq obj creation/deletion functions. */ -extern struct ip_masq *ip_masq_new(__u32 maddr, int proto, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned flags); -extern void ip_masq_set_expire(struct ip_masq *ms, unsigned long tout); +extern struct ip_masq *ip_masq_new(int proto, __u32 maddr, __u16 mport, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned flags); + +extern void ip_masq_control_add(struct ip_masq *ms, struct ip_masq* ctl_ms); +extern void ip_masq_control_del(struct ip_masq *ms); +extern struct ip_masq * ip_masq_control_get(struct ip_masq *ms); /* @@ -118,7 +145,7 @@ struct ip_masq_app int (*pkt_out) /* output (masquerading) hook */ (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, __u32); int (*pkt_in) /* input (demasq) hook */ - (struct ip_masq_app *, struct ip_masq *, struct sk_buff **); + (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, __u32); }; /* @@ -148,13 +175,109 @@ extern int ip_masq_unbind_app(struct ip_masq *ms); * */ extern int ip_masq_app_pkt_out(struct ip_masq *, struct sk_buff **skb_p, __u32 maddr); -extern int ip_masq_app_pkt_in(struct ip_masq *, struct sk_buff **skb_p); +extern int ip_masq_app_pkt_in(struct ip_masq *, struct sk_buff **skb_p, __u32 maddr); /* * service routine(s). */ -extern struct ip_masq * ip_masq_out_get_2(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); -extern struct ip_masq * ip_masq_in_get_2(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); + +extern struct ip_masq * ip_masq_out_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); +extern struct ip_masq * ip_masq_in_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port); + +extern int ip_masq_listen(struct ip_masq *); + +static __inline__ struct ip_masq * ip_masq_in_get_iph(const struct iphdr *iph) +{ + const __u16 *portp = (__u16 *)&(((char *)iph)[iph->ihl*4]); + return ip_masq_in_get(iph->protocol, + iph->saddr, portp[0], + iph->daddr, portp[1]); +} + +static __inline__ struct ip_masq * ip_masq_out_get_iph(const struct iphdr *iph) +{ + const __u16 *portp = (__u16 *)&(((char *)iph)[iph->ihl*4]); + return ip_masq_out_get(iph->protocol, + iph->saddr, portp[0], + iph->daddr, portp[1]); +} + +extern void ip_masq_put(struct ip_masq *ms); + + +/* + * Locking stuff + */ + + +static __inline__ void ip_masq_lock(atomic_t *lock, int rw) +{ +#if 0 + if (rw) +#endif + start_bh_atomic(); + atomic_inc(lock); +} + +static __inline__ void ip_masq_unlock(atomic_t *lock, int rw) +{ + atomic_dec(lock); +#if 0 + if (rw) +#endif + end_bh_atomic(); +} + +/* + * Sleep-able lockzzz... + */ +static __inline__ void ip_masq_lockz(atomic_t *lock, struct wait_queue ** waitq, int rw) +{ + if (rw) + while(atomic_read(lock)) sleep_on(waitq); + ip_masq_lock(lock, rw); +} + +static __inline__ void ip_masq_unlockz(atomic_t *lock, struct wait_queue ** waitq, int rw) +{ + ip_masq_unlock(lock, rw); + if (rw) + wake_up(waitq); +} + +/* + * Perfect for winning races ... ;) + */ +static __inline__ int ip_masq_nlocks(atomic_t *lock) +{ + return atomic_read(lock); +} + +extern atomic_t __ip_masq_lock; + +/* + * Debugging stuff + */ + +extern int ip_masq_get_debug_level(void); + +#ifndef CONFIG_IP_MASQ_NDEBUG +#define IP_MASQ_DEBUG(level, msg...) \ + if (level <= ip_masq_get_debug_level()) \ + printk(KERN_DEBUG "IP_MASQ:" ## msg) +#else /* NO DEBUGGING at ALL */ +#define IP_MASQ_DEBUG(level, msg...) do { } while (0) +#endif + +#define IP_MASQ_INFO(msg...) \ + printk(KERN_INFO "IP_MASQ:" ## msg) + +#define IP_MASQ_ERR(msg...) \ + printk(KERN_ERR "IP_MASQ:" ## msg) + +#define IP_MASQ_WARNING(msg...) \ + printk(KERN_WARNING "IP_MASQ:" ## msg) + /* * /proc/net entry @@ -167,6 +290,71 @@ extern int ip_masq_app_getinfo(char *buffer, char **start, off_t offset, int len */ extern struct sk_buff * ip_masq_skb_replace(struct sk_buff *skb, int pri, char *o_buf, int o_len, char *n_buf, int n_len); +/* + * masq_proto_num returns 0 for UDP, 1 for TCP, 2 for ICMP + */ + +static __inline__ int masq_proto_num(unsigned proto) +{ + switch (proto) + { + case IPPROTO_UDP: return (0); break; + case IPPROTO_TCP: return (1); break; + case IPPROTO_ICMP: return (2); break; + default: return (-1); break; + } +} + +static __inline__ const char *masq_proto_name(unsigned proto) +{ + static char buf[20]; + static const char *strProt[] = {"UDP","TCP","ICMP"}; + int msproto = masq_proto_num(proto); + + if (msproto<0||msproto>2) { + sprintf(buf, "IP_%d", proto); + return buf; + } + return strProt[msproto]; +} + +enum { + IP_MASQ_S_NONE = 0, + IP_MASQ_S_ESTABLISHED, + IP_MASQ_S_SYN_SENT, + IP_MASQ_S_SYN_RECV, + IP_MASQ_S_FIN_WAIT, + IP_MASQ_S_TIME_WAIT, + IP_MASQ_S_CLOSE, + IP_MASQ_S_CLOSE_WAIT, + IP_MASQ_S_LAST_ACK, + IP_MASQ_S_LISTEN, + IP_MASQ_S_UDP, + IP_MASQ_S_ICMP, + IP_MASQ_S_LAST +}; + +struct ip_masq_timeout_table { + atomic_t refcnt; + int scale; + int timeout[IP_MASQ_S_LAST+1]; +}; + +static __inline__ void ip_masq_timeout_attach(struct ip_masq *ms, struct ip_masq_timeout_table *mstim) +{ + atomic_inc (&mstim->refcnt); + ms->timeout_table=mstim; +} + +static __inline__ void ip_masq_timeout_detach(struct ip_masq *ms) +{ + struct ip_masq_timeout_table *mstim = ms->timeout_table; + + if (!mstim) + return; + atomic_dec(&mstim->refcnt); +} + #endif /* __KERNEL__ */ #endif /* _IP_MASQ_H */ diff --git a/include/net/ip_masq_mod.h b/include/net/ip_masq_mod.h new file mode 100644 index 000000000..427421d9b --- /dev/null +++ b/include/net/ip_masq_mod.h @@ -0,0 +1,78 @@ +/* + * IP Masquerading Modules Support + * + * Version: @(#)ip_masq_mod.h 0.01 97/10/30 + * + * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> + * + */ + + +#ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/ip_fw.h> +#include <linux/proc_fs.h> +#include <net/ip_masq.h> + +enum { + IP_MASQ_MOD_NOP, + IP_MASQ_MOD_ACCEPT, + IP_MASQ_MOD_REJECT +}; + +struct ip_masq_mod { + struct ip_masq_mod *next; /* next mod for addrs. lookups */ + struct ip_masq_mod *next_reg; /* next mod for configuration ctls */ + char *mmod_name; + atomic_t refcnt; + atomic_t mmod_nent; /* number of entries */ + struct proc_dir_entry *mmod_proc_ent; + int (*mmod_ctl) (int optname, struct ip_fw_masqctl *, int optlen); + int (*mmod_init) (void); + int (*mmod_done) (void); + int (*mmod_in_rule) (struct iphdr *, __u16 *); + int (*mmod_in_update) (struct iphdr *, struct ip_masq *); + struct ip_masq * (*mmod_in_create) (struct iphdr *, __u16 *, __u32); + int (*mmod_out_rule) (struct iphdr *, __u16 *); + int (*mmod_out_update) (struct iphdr *, __u16 *, struct ip_masq *); + struct ip_masq * (*mmod_out_create) (struct iphdr *, __u16 *, __u32); +}; + +/* + * Service routines (called from ip_masq.c) + */ +int ip_masq_mod_out_rule(struct iphdr *iph, __u16 *portp); +int ip_masq_mod_out_update(struct iphdr *iph, __u16 *portp, struct ip_masq *ms); +struct ip_masq * ip_masq_mod_out_create(struct iphdr *iph, __u16 *portp, __u32 maddr); + +int ip_masq_mod_in_rule(struct iphdr *iph, __u16 *portp); +int ip_masq_mod_in_update(struct iphdr *iph, __u16 *portp, struct ip_masq *ms); +struct ip_masq * ip_masq_mod_in_create(struct iphdr *iph, __u16 *portp, __u32 maddr); + +extern int ip_masq_mod_ctl(int optname, struct ip_fw_masqctl *, int len); + +/* + * ip_masq_mod registration functions + */ +extern int register_ip_masq_mod(struct ip_masq_mod *mmod); +extern int unregister_ip_masq_mod(struct ip_masq_mod *mmod); +extern int ip_masq_mod_lkp_unlink(struct ip_masq_mod *mmod); +extern int ip_masq_mod_lkp_link(struct ip_masq_mod *mmod); + +/* + * Utility ... + */ +static __inline__ void ip_masq_mod_dec_nent(struct ip_masq_mod *mmod) +{ + if (atomic_dec_and_test(&mmod->mmod_nent)) { + ip_masq_mod_lkp_unlink(mmod); + } +} +static __inline__ void ip_masq_mod_inc_nent(struct ip_masq_mod *mmod) +{ + atomic_inc(&mmod->mmod_nent); + if (atomic_read(&mmod->mmod_nent)==1) + ip_masq_mod_lkp_link(mmod); +} + +#endif /* __KERNEL__ */ diff --git a/include/net/ip_portfw.h b/include/net/ip_portfw.h new file mode 100644 index 000000000..f2b51ea1c --- /dev/null +++ b/include/net/ip_portfw.h @@ -0,0 +1,29 @@ +#ifndef _IP_PORTFW_H +#define _IP_PORTFW_H + +#include <linux/types.h> + +#define IP_PORTFW_PORT_MIN 1 +#define IP_PORTFW_PORT_MAX 60999 + +#ifdef __KERNEL__ +struct ip_portfw { + struct list_head list; + __u32 laddr, raddr; + __u16 lport, rport; + atomic_t pref_cnt; /* pref "counter" down to 0 */ + int pref; /* user set pref */ +}; +extern int ip_portfw_init(void); + +#endif /* __KERNEL__ */ + +struct ip_portfw_edits { + __u16 protocol; /* Which protocol are we talking? */ + __u32 laddr, raddr; /* Remote address */ + __u16 lport, rport; /* Local and remote port */ + __u16 dummy; /* Make up to multiple of 4 */ + int pref; /* Preference value */ +}; + +#endif diff --git a/include/net/llc.h b/include/net/llc.h index 37abe50af..654a658d7 100644 --- a/include/net/llc.h +++ b/include/net/llc.h @@ -13,6 +13,7 @@ struct llc_struct { char eye[4]; /* To recognize llc area in dump */ int retry_count; /* LLC link state variables */ + unsigned char name[9]; /* name of this llc instance */ unsigned char s_flag; unsigned char p_flag; unsigned char f_flag; @@ -68,9 +69,7 @@ struct llc_struct char * client_data; /* Pointer to clients context */ unsigned char local_sap; unsigned char remote_sap ; - char remote_mac[MAX_ADDR_LEN]; /* MAC address of remote session partner */ - int remote_mac_len; /* Actual length of mac address */ - int mac_offset; /* Source mac offset in skb */ + char remote_mac[MAX_ADDR_LEN]; /* MAC address of remote session partner */ struct device *dev; /* Device we are attached to */ unsigned char llc_mode; /* See doc 7.1 on p70 */ @@ -132,3 +131,5 @@ void llc_test_request(llcptr lp, int data_len, char *pdu_data); int register_cl2llc_client(llcptr llc, const char *device, void (*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap); void unregister_cl2llc_client(llcptr lp); +int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb ); + diff --git a/include/net/tcp.h b/include/net/tcp.h index f47a273d0..39c1b1f70 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -181,6 +181,9 @@ static __inline__ void tcp_sk_unbindify(struct sock *sk) * to be no checksum */ #define TCP_SYNACK_PERIOD (HZ/2) +#define TCP_QUICK_TRIES 8 /* How often we try to retransmit, until + * we tell the LL layer that it is something + * wrong (e.g. that it can expire redirects) */ /* * TCP option @@ -462,8 +465,6 @@ extern int tcp_chkaddr(struct sk_buff *); /* tcp_timer.c */ #define tcp_reset_msl_timer(x,y,z) net_reset_timer(x,y,z) extern void tcp_reset_xmit_timer(struct sock *, int, unsigned long); -extern void tcp_clear_xmit_timer(struct sock *, int); -extern int tcp_timer_is_set(struct sock *, int); extern void tcp_init_xmit_timers(struct sock *); extern void tcp_clear_xmit_timers(struct sock *); @@ -744,4 +745,49 @@ extern __inline__ void tcp_dec_slow_timer(int timer) atomic_dec(&slt->count); } +extern const char timer_bug_msg[]; + +static inline void tcp_clear_xmit_timer(struct sock *sk, int what) +{ + struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; + struct timer_list *timer; + + switch (what) { + case TIME_RETRANS: + timer = &tp->retransmit_timer; + break; + case TIME_DACK: + timer = &tp->delack_timer; + break; + case TIME_PROBE0: + timer = &tp->probe_timer; + break; + default: + printk(timer_bug_msg); + return; + }; + del_timer(timer); +} + +static inline int tcp_timer_is_set(struct sock *sk, int what) +{ + struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; + + switch (what) { + case TIME_RETRANS: + return tp->retransmit_timer.next != NULL; + break; + case TIME_DACK: + return tp->delack_timer.next != NULL; + break; + case TIME_PROBE0: + return tp->probe_timer.next != NULL; + break; + default: + printk(timer_bug_msg); + }; + return 0; +} + + #endif /* _TCP_H */ |