summaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-21 22:00:56 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-21 22:00:56 +0000
commit168660f24dfc46c2702acbe4701a446f42a59578 (patch)
treef431368afbf6b1b71809cf3fd904d800ea126f4d /net/ipv4
parent6420f767924fa73b0ea267864d96820815f4ba5a (diff)
Merge with Linux 2.4.0-test5-pre3.
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_options.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipconfig.c2
-rw-r--r--net/ipv4/netfilter/ipfwadm_core.c6
-rw-r--r--net/ipv4/netfilter/ipt_REJECT.c55
-rw-r--r--net/ipv4/syncookies.c2
-rw-r--r--net/ipv4/tcp_ipv4.c4
9 files changed, 42 insertions, 37 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index d50b56ea9..a7f5d3e49 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -99,7 +99,7 @@ static __inline__ void inet_free_ifa(struct in_ifaddr *ifa)
{
if (ifa->ifa_dev)
__in_dev_put(ifa->ifa_dev);
- kfree_s(ifa, sizeof(*ifa));
+ kfree(ifa);
inet_ifa_count--;
}
@@ -118,7 +118,7 @@ void in_dev_finish_destroy(struct in_device *idev)
return;
}
inet_dev_count--;
- kfree_s(idev, sizeof(*idev));
+ kfree(idev);
}
struct in_device *inetdev_init(struct net_device *dev)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index aed0945c5..94d64999f 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -129,7 +129,7 @@ static void ip_ma_put(struct ip_mc_list *im)
{
if (atomic_dec_and_test(&im->refcnt)) {
in_dev_put(im->interface);
- kfree_s(im, sizeof(*im));
+ kfree(im);
}
}
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 359926a4c..89b3206f0 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -509,7 +509,7 @@ int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen, in
opt->is_data = 1;
opt->is_setbyuser = 1;
if (optlen && ip_options_compile(opt, NULL)) {
- kfree_s(opt, sizeof(struct ip_options) + optlen);
+ kfree(opt);
return -EINVAL;
}
*optp = opt;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index aea8b9370..c1c0bb047 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -429,7 +429,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char *optval, int opt
}
opt = xchg(&sk->protinfo.af_inet.opt, opt);
if (opt)
- kfree_s(opt, sizeof(struct ip_options) + opt->optlen);
+ kfree(opt);
break;
}
case IP_PKTINFO:
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index f34fa37d2..765da5148 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -175,7 +175,7 @@ static void __init ic_close_devs(void)
DBG(("IP-Config: Downing %s\n", dev->name));
dev_change_flags(dev, d->flags);
}
- kfree_s(d, sizeof(struct ic_device));
+ kfree(d);
}
rtnl_shunlock();
}
diff --git a/net/ipv4/netfilter/ipfwadm_core.c b/net/ipv4/netfilter/ipfwadm_core.c
index 4b4ab23b8..36614409d 100644
--- a/net/ipv4/netfilter/ipfwadm_core.c
+++ b/net/ipv4/netfilter/ipfwadm_core.c
@@ -684,7 +684,7 @@ static void free_fw_chain(struct ip_fw *volatile* chainptr)
struct ip_fw *ftmp;
ftmp = *chainptr;
*chainptr = ftmp->fw_next;
- kfree_s(ftmp,sizeof(*ftmp));
+ kfree(ftmp);
}
restore_flags(flags);
}
@@ -834,13 +834,13 @@ static int del_from_chain(struct ip_fw *volatile*chainptr, struct ip_fw *frwl)
if (ltmp)
{
ltmp->fw_next=ftmp->fw_next;
- kfree_s(ftmp,sizeof(*ftmp));
+ kfree(ftmp);
ftmp=ltmp->fw_next;
}
else
{
*chainptr=ftmp->fw_next;
- kfree_s(ftmp,sizeof(*ftmp));
+ kfree(ftmp);
ftmp=*chainptr;
}
}
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index c63e95fe8..7c8bf2f1e 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -2,6 +2,7 @@
* This is a module which is used for rejecting packets.
* Added support for customized reject packets (Jozsef Kadlecsik).
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
@@ -23,13 +24,33 @@ struct in_device;
static void send_reset(struct sk_buff *oldskb)
{
struct sk_buff *nskb;
- struct tcphdr *tcph;
+ struct tcphdr *otcph, *tcph;
struct rtable *rt;
- unsigned int tcplen;
+ unsigned int otcplen;
int needs_ack;
- /* Clone skb (skb is about to be dropped, so we don't care) */
- nskb = skb_clone(oldskb, GFP_ATOMIC);
+ /* IP header checks: fragment, too short. */
+ if (oldskb->nh.iph->frag_off & htons(IP_OFFSET)
+ || oldskb->len < (oldskb->nh.iph->ihl<<2) + sizeof(struct tcphdr))
+ return;
+
+ otcph = (struct tcphdr *)((u_int32_t*)oldskb->nh.iph + oldskb->nh.iph->ihl);
+ otcplen = oldskb->len - oldskb->nh.iph->ihl*4;
+
+ /* No RST for RST. */
+ if (otcph->rst)
+ return;
+
+ /* Check checksum. */
+ if (tcp_v4_check(otcph, otcplen, oldskb->nh.iph->saddr,
+ oldskb->nh.iph->daddr,
+ csum_partial((char *)otcph, otcplen, 0)) != 0)
+ return;
+
+ /* Copy skb (even if skb is about to be dropped, we can't just
+ clone it because there may be other things, such as tcpdump,
+ interested in it) */
+ nskb = skb_copy(oldskb, GFP_ATOMIC);
if (!nskb)
return;
@@ -41,23 +62,7 @@ static void send_reset(struct sk_buff *oldskb)
nskb->nf_debug = 0;
#endif
- /* IP header checks: fragment, too short. */
- if (nskb->nh.iph->frag_off & htons(IP_OFFSET)
- || nskb->len < (nskb->nh.iph->ihl<<2) + sizeof(struct tcphdr))
- goto free_nskb;
-
tcph = (struct tcphdr *)((u_int32_t*)nskb->nh.iph + nskb->nh.iph->ihl);
- tcplen = nskb->len - nskb->nh.iph->ihl*4;
-
- /* Check checksum. */
- if (tcp_v4_check(tcph, tcplen, nskb->nh.iph->saddr,
- nskb->nh.iph->daddr,
- csum_partial((char *)tcph, tcplen, 0)) != 0)
- goto free_nskb;
-
- /* No RST for RST. */
- if (tcph->rst)
- goto free_nskb;
nskb->nh.iph->daddr = xchg(&nskb->nh.iph->saddr, nskb->nh.iph->daddr);
tcph->source = xchg(&tcph->dest, tcph->source);
@@ -65,23 +70,23 @@ static void send_reset(struct sk_buff *oldskb)
/* Truncate to length (no data) */
tcph->doff = sizeof(struct tcphdr)/4;
skb_trim(nskb, nskb->nh.iph->ihl*4 + sizeof(struct tcphdr));
+ nskb->nh.iph->tot_len = htons(nskb->len);
if (tcph->ack) {
needs_ack = 0;
- tcph->seq = tcph->ack_seq;
+ tcph->seq = otcph->ack_seq;
tcph->ack_seq = 0;
} else {
needs_ack = 1;
+ tcph->ack_seq = htonl(ntohl(otcph->seq) + otcph->syn + otcph->fin
+ + otcplen - (otcph->doff<<2));
tcph->seq = 0;
- tcph->ack_seq = htonl(ntohl(tcph->seq) + tcph->syn + tcph->fin
- + tcplen - (tcph->doff<<2));
}
/* Reset flags */
((u_int8_t *)tcph)[13] = 0;
tcph->rst = 1;
- if (needs_ack)
- tcph->ack = 1;
+ tcph->ack = needs_ack;
tcph->window = 0;
tcph->urg_ptr = 0;
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index d218c3bdb..39cd96ede 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -159,7 +159,7 @@ cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct ip_options *opt)
req->af.v4_req.opt = kmalloc(opt_size, GFP_ATOMIC);
if (req->af.v4_req.opt) {
if (ip_options_echo(req->af.v4_req.opt, skb)) {
- kfree_s(req->af.v4_req.opt, opt_size);
+ kfree(req->af.v4_req.opt);
req->af.v4_req.opt = NULL;
}
}
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 46f5e57e8..1fcf0e255 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1232,7 +1232,7 @@ out:
static void tcp_v4_or_free(struct open_request *req)
{
if (req->af.v4_req.opt)
- kfree_s(req->af.v4_req.opt, optlength(req->af.v4_req.opt));
+ kfree(req->af.v4_req.opt);
}
static inline void syn_flood_warning(struct sk_buff *skb)
@@ -1261,7 +1261,7 @@ tcp_v4_save_options(struct sock *sk, struct sk_buff *skb)
dopt = kmalloc(opt_size, GFP_ATOMIC);
if (dopt) {
if (ip_options_echo(dopt, skb)) {
- kfree_s(dopt, opt_size);
+ kfree(dopt);
dopt = NULL;
}
}