summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /include/net
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip.h17
-rw-r--r--include/net/ip_autofw.h33
-rw-r--r--include/net/ip_fib.h14
-rw-r--r--include/net/ip_masq.h121
-rw-r--r--include/net/ip_masq_mod.h46
-rw-r--r--include/net/ip_portfw.h29
-rw-r--r--include/net/ipv6.h7
-rw-r--r--include/net/rose.h23
-rw-r--r--include/net/scm.h3
-rw-r--r--include/net/snmp.h2
-rw-r--r--include/net/sock.h24
-rw-r--r--include/net/tcp.h38
12 files changed, 150 insertions, 207 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 63ef8b0a2..52686031e 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -166,7 +166,7 @@ extern __inline__ void ip_send(struct sk_buff *skb)
ip_finish_output(skb);
}
-static __inline__
+extern __inline__
int ip_decrease_ttl(struct iphdr *iph)
{
u16 check = iph->check;
@@ -177,6 +177,14 @@ int ip_decrease_ttl(struct iphdr *iph)
return --iph->ttl;
}
+extern __inline__
+int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
+{
+ return (sk->ip_pmtudisc == IP_PMTUDISC_DO ||
+ (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
+ !(dst->mxlock&(1<<RTAX_MTU))));
+}
+
/*
* Map a multicast IP onto multicast MAC for type ethernet.
*/
@@ -233,7 +241,10 @@ extern int ip_setsockopt(struct sock *sk, int level, int optname, char *optval,
extern int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *optlen);
extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
-extern int ipv4_backlog_rcv(struct sock *sk, struct sk_buff *skb);
-
+extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
+extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
+ u16 port, u32 info, u8 *payload);
+extern void ip_local_error(struct sock *sk, int err, u32 daddr, u16 dport,
+ u32 info);
#endif /* _IP_H */
diff --git a/include/net/ip_autofw.h b/include/net/ip_autofw.h
deleted file mode 100644
index feeec7bb1..000000000
--- a/include/net/ip_autofw.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#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_fib.h b/include/net/ip_fib.h
index b79e4d0fb..5c8d6bf8e 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -27,17 +27,10 @@ struct kern_rta
void *rta_gw;
u32 *rta_priority;
void *rta_prefsrc;
-#ifdef CONFIG_RTNL_OLD_IFINFO
- unsigned *rta_window;
- unsigned *rta_rtt;
- unsigned *rta_mtu;
- unsigned char *rta_ifname;
-#else
struct rtattr *rta_mx;
struct rtattr *rta_mp;
unsigned char *rta_protoinfo;
unsigned char *rta_flow;
-#endif
struct rta_cacheinfo *rta_ci;
};
@@ -69,17 +62,12 @@ struct fib_info
unsigned fib_flags;
int fib_protocol;
u32 fib_prefsrc;
-#ifdef CONFIG_RTNL_OLD_IFINFO
- unsigned fib_mtu;
- unsigned fib_rtt;
- unsigned fib_window;
-#else
+ u32 fib_priority;
#define FIB_MAX_METRICS RTAX_RTT
unsigned fib_metrics[FIB_MAX_METRICS];
#define fib_mtu fib_metrics[RTAX_MTU-1]
#define fib_window fib_metrics[RTAX_WINDOW-1]
#define fib_rtt fib_metrics[RTAX_RTT-1]
-#endif
int fib_nhs;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
int fib_power;
diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h
index 716eea2ef..03c65fddc 100644
--- a/include/net/ip_masq.h
+++ b/include/net/ip_masq.h
@@ -2,7 +2,7 @@
* IP masquerading functionality definitions
*/
-#include <linux/config.h> /* for CONFIG_IP_MASQ_NDEBUG */
+#include <linux/config.h> /* for CONFIG_IP_MASQ_DEBUG */
#ifndef _IP_MASQ_H
#define _IP_MASQ_H
@@ -36,18 +36,27 @@
*/
#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_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 */
+#define IP_MASQ_MOD_CTL 0x00
+#define IP_MASQ_USER_CTL 0x01
#ifdef __KERNEL__
+#define IP_MASQ_TAB_SIZE 256
+
+#define IP_MASQ_F_NO_DADDR 0x0001 /* no daddr yet */
+#define IP_MASQ_F_NO_DPORT 0x0002 /* no dport set yet */
+#define IP_MASQ_F_NO_SADDR 0x0004 /* no sport set yet */
+#define IP_MASQ_F_NO_SPORT 0x0008 /* no sport set yet */
+
+#define IP_MASQ_F_NO_REPLY 0x0010 /* no reply yet from outside */
+
+#define IP_MASQ_F_HASHED 0x0100 /* hashed entry */
+#define IP_MASQ_F_OUT_SEQ 0x0200 /* must do output seq adjust */
+#define IP_MASQ_F_IN_SEQ 0x0400 /* must do input seq adjust */
+
+#define IP_MASQ_F_MPORT 0x1000 /* own mport specified */
+#define IP_MASQ_F_USER 0x2000 /* from uspace */
+
/*
* Delta seq. info structure
* Each MASQ struct has 2 (output AND input seq. changes).
@@ -81,7 +90,8 @@ struct ip_masq {
};
/*
- * timeout values
+ * Timeout values
+ * ipchains holds a copy of this definition
*/
struct ip_fw_masq {
@@ -90,8 +100,13 @@ struct ip_fw_masq {
int udp_timeout;
};
-extern struct ip_fw_masq *ip_masq_expire;
-
+union ip_masq_tphdr {
+ unsigned char *raw;
+ struct udphdr *uh;
+ struct tcphdr *th;
+ struct icmphdr *icmph;
+ __u16 *portp;
+};
/*
* [0]: UDP free_ports
* [1]: TCP free_ports
@@ -121,7 +136,18 @@ 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);
+struct ip_masq_ctl;
+
+struct ip_masq_hook {
+ int (*ctl)(int, struct ip_masq_ctl *, int);
+ int (*info)(char *, char **, off_t, int, int);
+};
+extern struct ip_masq *ip_masq_m_tab[IP_MASQ_TAB_SIZE];
+extern struct ip_masq *ip_masq_s_tab[IP_MASQ_TAB_SIZE];
+extern const char * ip_masq_state_name(int state);
+extern struct ip_masq_hook *ip_masq_user_hook;
+extern u32 ip_masq_select_addr(struct device *dev, u32 dst, int scope);
/*
*
* IP_MASQ_APP: IP application masquerading definitions
@@ -201,55 +227,26 @@ static __inline__ struct ip_masq * ip_masq_out_get_iph(const struct iphdr *iph)
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();
-}
-
+extern rwlock_t __ip_masq_lock;
+
+#ifdef __SMP__
+#define read_lock_bh(lock) do { start_bh_atomic(); read_lock(lock); \
+ } while (0)
+#define read_unlock_bh(lock) do { read_unlock(lock); end_bh_atomic(); \
+ } while (0)
+#define write_lock_bh(lock) do { start_bh_atomic(); write_lock(lock); \
+ } while (0)
+#define write_unlock_bh(lock) do { write_unlock(lock); end_bh_atomic(); \
+ } while (0)
+#else
+#define read_lock_bh(lock) start_bh_atomic()
+#define read_unlock_bh(lock) end_bh_atomic()
+#define write_lock_bh(lock) start_bh_atomic()
+#define write_unlock_bh(lock) end_bh_atomic()
+#endif
/*
- * 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
@@ -257,7 +254,7 @@ extern atomic_t __ip_masq_lock;
extern int ip_masq_get_debug_level(void);
-#ifndef CONFIG_IP_MASQ_NDEBUG
+#ifdef CONFIG_IP_MASQ_DEBUG
#define IP_MASQ_DEBUG(level, msg...) do { \
if (level <= ip_masq_get_debug_level()) \
printk(KERN_DEBUG "IP_MASQ:" ## msg); \
@@ -279,6 +276,8 @@ extern int ip_masq_get_debug_level(void);
/*
* /proc/net entry
*/
+extern int ip_masq_proc_register(struct proc_dir_entry *);
+extern void ip_masq_proc_unregister(struct proc_dir_entry *);
extern int ip_masq_app_getinfo(char *buffer, char **start, off_t offset, int length, int dummy);
/*
diff --git a/include/net/ip_masq_mod.h b/include/net/ip_masq_mod.h
index 427421d9b..7cd9a7f32 100644
--- a/include/net/ip_masq_mod.h
+++ b/include/net/ip_masq_mod.h
@@ -14,11 +14,9 @@
#include <linux/proc_fs.h>
#include <net/ip_masq.h>
-enum {
- IP_MASQ_MOD_NOP,
- IP_MASQ_MOD_ACCEPT,
- IP_MASQ_MOD_REJECT
-};
+#define IP_MASQ_MOD_NOP 0
+#define IP_MASQ_MOD_ACCEPT 1
+#define IP_MASQ_MOD_REJECT -1
struct ip_masq_mod {
struct ip_masq_mod *next; /* next mod for addrs. lookups */
@@ -27,29 +25,32 @@ struct ip_masq_mod {
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_ctl) (int optname, struct ip_masq_ctl *, 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);
+ int (*mmod_in_rule) (const struct sk_buff *, const struct iphdr *);
+ int (*mmod_in_update) (const struct sk_buff *, const struct iphdr *,
+ struct ip_masq *);
+ struct ip_masq * (*mmod_in_create) (const struct sk_buff *, const struct iphdr *, __u32);
+ int (*mmod_out_rule) (const struct sk_buff *, const struct iphdr *);
+ int (*mmod_out_update) (const struct sk_buff *, const struct iphdr *,
+ struct ip_masq *);
+ struct ip_masq * (*mmod_out_create) (const struct sk_buff *, const struct iphdr *, __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);
+int ip_masq_mod_out_rule(const struct sk_buff *, const struct iphdr *);
+int ip_masq_mod_out_update(const struct sk_buff *, const struct iphdr *, struct ip_masq *ms);
+struct ip_masq * ip_masq_mod_out_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr);
+
+int ip_masq_mod_in_rule(const struct sk_buff *, const struct iphdr *iph);
+int ip_masq_mod_in_update(const struct sk_buff *, const struct iphdr *iph, struct ip_masq *ms);
+struct ip_masq * ip_masq_mod_in_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr);
-extern int ip_masq_mod_ctl(int optname, struct ip_fw_masqctl *, int len);
+extern int ip_masq_mod_ctl(int optname, struct ip_masq_ctl *, int len);
/*
* ip_masq_mod registration functions
@@ -60,6 +61,13 @@ extern int ip_masq_mod_lkp_unlink(struct ip_masq_mod *mmod);
extern int ip_masq_mod_lkp_link(struct ip_masq_mod *mmod);
/*
+ * init functions protos
+ */
+extern int ip_portfw_init(void);
+extern int ip_markfw_init(void);
+extern int ip_autofw_init(void);
+
+/*
* Utility ...
*/
static __inline__ void ip_masq_mod_dec_nent(struct ip_masq_mod *mmod)
diff --git a/include/net/ip_portfw.h b/include/net/ip_portfw.h
deleted file mode 100644
index f2b51ea1c..000000000
--- a/include/net/ip_portfw.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#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/ipv6.h b/include/net/ipv6.h
index 03f30b644..118eec2e9 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -4,7 +4,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: ipv6.h,v 1.13 1998/08/26 12:02:11 davem Exp $
+ * $Id: ipv6.h,v 1.14 1998/10/03 09:36:45 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -284,6 +284,11 @@ extern void ipv6_packet_cleanup(void);
extern void ipv6_netdev_notif_cleanup(void);
+extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
+extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 port,
+ u32 info, u8 *payload);
+extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info);
+
#endif /* __KERNEL__ */
#endif /* _NET_IPV6_H */
diff --git a/include/net/rose.h b/include/net/rose.h
index 366168287..1c8684d2d 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -56,7 +56,7 @@ enum {
#define ROSE_DEFAULT_ROUTING 1 /* Default routing flag */
#define ROSE_DEFAULT_FAIL_TIMEOUT (120 * HZ) /* Time until link considered usable */
#define ROSE_DEFAULT_MAXVC 50 /* Maximum number of VCs per neighbour */
-#define ROSE_DEFAULT_WINDOW_SIZE 3 /* Default window size */
+#define ROSE_DEFAULT_WINDOW_SIZE 7 /* Default window size */
#define ROSE_MODULUS 8
#define ROSE_MAX_PACKET_SIZE 251 /* Maximum packet size */
@@ -72,6 +72,9 @@ enum {
#define FAC_NATIONAL_FLAGS 0x3F
#define FAC_NATIONAL_DEST_DIGI 0xE9
#define FAC_NATIONAL_SRC_DIGI 0xEB
+#define FAC_NATIONAL_FAIL_CALL 0xED
+#define FAC_NATIONAL_FAIL_ADD 0xEE
+#define FAC_NATIONAL_DIGIS 0xEF
#define FAC_CCITT_DEST_NSAP 0xC9
#define FAC_CCITT_SRC_NSAP 0xCB
@@ -111,19 +114,12 @@ struct rose_route {
unsigned int rand;
};
-struct rose_facilities {
- rose_address source_addr, dest_addr;
- ax25_address source_call, dest_call;
- unsigned char source_ndigis, dest_ndigis;
- ax25_address source_digi, dest_digi;
- unsigned int rand;
-};
-
typedef struct {
rose_address source_addr, dest_addr;
ax25_address source_call, dest_call;
unsigned char source_ndigis, dest_ndigis;
- ax25_address source_digi, dest_digi;
+ ax25_address source_digis[ROSE_MAX_DIGIS];
+ ax25_address dest_digis[ROSE_MAX_DIGIS];
struct rose_neigh *neighbour;
struct device *device;
unsigned int lci, rand;
@@ -131,7 +127,12 @@ typedef struct {
unsigned char cause, diagnostic;
unsigned short vs, vr, va, vl;
unsigned long t1, t2, t3, hb, idle;
+#ifdef M_BIT
+ unsigned short fraglen;
+ struct sk_buff_head frag_queue;
+#endif
struct sk_buff_head ack_queue;
+ struct rose_facilities_struct facilities;
struct timer_list timer;
struct timer_list idletimer;
struct sock *sk; /* Backlink to socket */
@@ -218,7 +219,7 @@ extern void rose_requeue_frames(struct sock *);
extern int rose_validate_nr(struct sock *, unsigned short);
extern void rose_write_internal(struct sock *, int);
extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
-extern int rose_parse_facilities(struct sk_buff *, struct rose_facilities *);
+extern int rose_parse_facilities(unsigned char *, struct rose_facilities_struct *);
extern int rose_create_facilities(unsigned char *, rose_cb *);
extern void rose_disconnect(struct sock *, int, int, int);
diff --git a/include/net/scm.h b/include/net/scm.h
index 0c6a01542..98c2dc916 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -17,8 +17,6 @@ struct scm_cookie
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
unsigned long seq; /* Connection seqno */
- struct file *file; /* file for socket */
- struct socket *sock; /* Passed socket */
};
extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
@@ -39,7 +37,6 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
scm->creds.uid = current->uid;
scm->creds.gid = current->gid;
scm->creds.pid = current->pid;
- scm->sock = sock;
if (msg->msg_controllen <= 0)
return 0;
return __scm_send(sock, msg, scm);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index e38826d0b..cc8354b6c 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -176,6 +176,8 @@ struct linux_mib
unsigned long PruneCalled;
unsigned long RcvPruned;
unsigned long OfoPruned;
+ unsigned long OutOfWindowIcmps;
+ unsigned long LockDroppedIcmps;
};
#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index ad27511c2..a9cc39260 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -139,6 +139,7 @@ struct ipv6_pinfo {
struct in6_addr *daddr_cache;
__u32 flow_lbl;
+ __u32 frag_size;
int hop_limit;
int mcast_hops;
int mcast_oif;
@@ -159,7 +160,9 @@ struct ipv6_pinfo {
} rxopt;
/* sockopt flags */
- __u8 mc_loop:1;
+ __u8 mc_loop:1,
+ recverr:1,
+ pmtudisc:2;
struct ipv6_mc_socklist *ipv6_mc_list;
__u32 dst_cookie;
@@ -238,6 +241,7 @@ struct tcp_opt {
* Slow start and congestion control (see also Nagle, and Karn & Partridge)
*/
__u32 snd_ssthresh; /* Slow start size threshold */
+ __u16 snd_cwnd_cnt; /* Linear increase counter */
__u8 dup_acks; /* Consequetive duplicate acks seen from other end */
__u8 delayed_acks;
__u16 user_mss; /* mss requested by user in ioctl */
@@ -531,7 +535,7 @@ struct proto {
struct sock *sklist_prev;
void (*close)(struct sock *sk,
- unsigned long timeout);
+ long timeout);
int (*connect)(struct sock *sk,
struct sockaddr *uaddr,
int addr_len);
@@ -841,20 +845,6 @@ extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
return 0;
}
-extern __inline__ int __sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
-{
- /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
- number of warnings when compiling with -W --ANK
- */
- if (atomic_read(&sk->rmem_alloc) + skb->truesize >= (unsigned)sk->rcvbuf)
- return -ENOMEM;
- skb_set_owner_r(skb, sk);
- __skb_queue_tail(&sk->receive_queue,skb);
- if (!sk->dead)
- sk->data_ready(sk,skb->len);
- return 0;
-}
-
extern __inline__ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
{
/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
@@ -863,7 +853,7 @@ extern __inline__ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
if (atomic_read(&sk->rmem_alloc) + skb->truesize >= (unsigned)sk->rcvbuf)
return -ENOMEM;
skb_set_owner_r(skb, sk);
- __skb_queue_tail(&sk->error_queue,skb);
+ skb_queue_tail(&sk->error_queue,skb);
if (!sk->dead)
sk->data_ready(sk,skb->len);
return 0;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 3f305aa7e..2ebee4e0d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -192,7 +192,7 @@ extern kmem_cache_t *tcp_timewait_cachep;
(((__u32)(__dport)<<16) | (__u32)(__sport))
#endif
-#if defined(__alpha__) || defined(__sparc_v9__)
+#if (BITS_PER_LONG == 64)
#ifdef __BIG_ENDIAN
#define TCP_V4_ADDR_COOKIE(__name, __saddr, __daddr) \
__u64 __name = (((__u64)(__saddr))<<32)|((__u64)(__daddr));
@@ -511,7 +511,7 @@ extern int tcp_timewait_state_process(struct tcp_tw_bucket *tw,
unsigned len);
extern void tcp_close(struct sock *sk,
- unsigned long timeout);
+ long timeout);
extern struct sock * tcp_accept(struct sock *sk, int flags);
extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
extern void tcp_write_space(struct sock *sk);
@@ -675,7 +675,7 @@ static __inline__ u32 tcp_receive_window(struct tcp_opt *tp)
* scaling applied to the result. The caller does these things
* if necessary. This is a "raw" window selection.
*/
-extern u32 __tcp_select_window(struct sock *sk, u32 cur_win);
+extern u32 __tcp_select_window(struct sock *sk);
/* Chose a new window to advertise, update state in tcp_opt for the
* socket, and return result with RFC1323 scaling applied. The return
@@ -686,13 +686,20 @@ extern __inline__ u16 tcp_select_window(struct sock *sk)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
u32 cur_win = tcp_receive_window(tp);
- u32 new_win = __tcp_select_window(sk, cur_win);
+ u32 new_win = __tcp_select_window(sk);
/* Never shrink the offered window */
- if(new_win < cur_win)
+ if(new_win < cur_win) {
+ /* Danger Will Robinson!
+ * Don't update rcv_wup/rcv_wnd here or else
+ * we will not be able to advertise a zero
+ * window in time. --DaveM
+ */
new_win = cur_win;
- tp->rcv_wnd = new_win;
- tp->rcv_wup = tp->rcv_nxt;
+ } else {
+ tp->rcv_wnd = new_win;
+ tp->rcv_wup = tp->rcv_nxt;
+ }
/* RFC1323 scaling applied */
return new_win >> tp->rcv_wscale;
@@ -706,7 +713,7 @@ extern __inline__ int tcp_raise_window(struct sock *sk)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
u32 cur_win = tcp_receive_window(tp);
- u32 new_win = __tcp_select_window(sk, cur_win);
+ u32 new_win = __tcp_select_window(sk);
return (new_win && (new_win > (cur_win << 1)));
}
@@ -750,12 +757,6 @@ struct tcp_skb_cb {
#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
-/* We store the congestion window as a packet count, shifted by
- * a factor so that implementing the 1/2 MSS ssthresh rules
- * is easy.
- */
-#define TCP_CWND_SHIFT 1
-
/* This determines how many packets are "in the network" to the best
* of our knowledge. In many cases it is conservative, but where
* detailed information is available from the receiver (via SACK
@@ -796,12 +797,15 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb)
*
* Don't use the nagle rule for urgent data.
*/
- if (!sk->nonagle && skb->len < (tp->mss_cache >> 1) && tp->packets_out &&
- !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_URG))
+ if ((sk->nonagle == 2 && (skb->len < tp->mss_cache)) ||
+ (!sk->nonagle &&
+ skb->len < (tp->mss_cache >> 1) &&
+ tp->packets_out &&
+ !(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_URG)))
nagle_check = 0;
return (nagle_check &&
- (tcp_packets_in_flight(tp) < (tp->snd_cwnd>>TCP_CWND_SHIFT)) &&
+ (tcp_packets_in_flight(tp) < tp->snd_cwnd) &&
!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) &&
tp->retransmits == 0);
}