projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'linux-2.6'
[powerpc.git]
/
net
/
ipv4
/
icmp.c
diff --git
a/net/ipv4/icmp.c
b/net/ipv4/icmp.c
index
0179001
..
d38cbba
100644
(file)
--- a/
net/ipv4/icmp.c
+++ b/
net/ipv4/icmp.c
@@
-64,7
+64,6
@@
*
*/
*
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/jiffies.h>
@@
-105,7
+104,7
@@
struct icmp_bxm {
struct {
struct icmphdr icmph;
struct {
struct icmphdr icmph;
- __
u32
times[3];
+ __
be32
times[3];
} data;
int head_len;
struct ip_options replyopts;
} data;
int head_len;
struct ip_options replyopts;
@@
-188,11
+187,11
@@
struct icmp_err icmp_err_convert[] = {
};
/* Control parameters for ECHO replies. */
};
/* Control parameters for ECHO replies. */
-int sysctl_icmp_echo_ignore_all;
-int sysctl_icmp_echo_ignore_broadcasts = 1;
+int sysctl_icmp_echo_ignore_all
__read_mostly
;
+int sysctl_icmp_echo_ignore_broadcasts
__read_mostly
= 1;
/* Control parameter - ignore bogus broadcast responses? */
/* Control parameter - ignore bogus broadcast responses? */
-int sysctl_icmp_ignore_bogus_error_responses = 1;
+int sysctl_icmp_ignore_bogus_error_responses
__read_mostly
= 1;
/*
* Configurable global rate limit.
/*
* Configurable global rate limit.
@@
-206,9
+205,9
@@
int sysctl_icmp_ignore_bogus_error_responses = 1;
* time exceeded (11), parameter problem (12)
*/
* time exceeded (11), parameter problem (12)
*/
-int sysctl_icmp_ratelimit = 1 * HZ;
-int sysctl_icmp_ratemask = 0x1818;
-int sysctl_icmp_errors_use_inbound_ifaddr;
+int sysctl_icmp_ratelimit
__read_mostly
= 1 * HZ;
+int sysctl_icmp_ratemask
__read_mostly
= 0x1818;
+int sysctl_icmp_errors_use_inbound_ifaddr
__read_mostly
;
/*
* ICMP control array. This specifies what to do with each ICMP.
/*
* ICMP control array. This specifies what to do with each ICMP.
@@
-305,7
+304,7
@@
static inline int icmpv4_xrlim_allow(struct rtable *rt, int type, int code)
/* No rate limit on loopback */
if (dst->dev && (dst->dev->flags&IFF_LOOPBACK))
/* No rate limit on loopback */
if (dst->dev && (dst->dev->flags&IFF_LOOPBACK))
- goto out;
+ goto out;
/* Limit if icmp type is enabled in ratemask. */
if ((1 << type) & sysctl_icmp_ratemask)
/* Limit if icmp type is enabled in ratemask. */
if ((1 << type) & sysctl_icmp_ratemask)
@@
-333,7
+332,7
@@
static int icmp_glue_bits(void *from, char *to, int offset, int len, int odd,
struct sk_buff *skb)
{
struct icmp_bxm *icmp_param = (struct icmp_bxm *)from;
struct sk_buff *skb)
{
struct icmp_bxm *icmp_param = (struct icmp_bxm *)from;
-
unsigned int
csum;
+
__wsum
csum;
csum = skb_copy_and_csum_bits(icmp_param->skb,
icmp_param->offset + offset,
csum = skb_copy_and_csum_bits(icmp_param->skb,
icmp_param->offset + offset,
@@
-351,13
+350,13
@@
static void icmp_push_reply(struct icmp_bxm *icmp_param,
struct sk_buff *skb;
if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param,
struct sk_buff *skb;
if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param,
- icmp_param->data_len+icmp_param->head_len,
- icmp_param->head_len,
- ipc, rt, MSG_DONTWAIT) < 0)
+ icmp_param->data_len+icmp_param->head_len,
+ icmp_param->head_len,
+ ipc, rt, MSG_DONTWAIT) < 0)
ip_flush_pending_frames(icmp_socket->sk);
else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
ip_flush_pending_frames(icmp_socket->sk);
else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
- struct icmphdr *icmph =
skb->h.icmph
;
-
unsigned int
csum = 0;
+ struct icmphdr *icmph =
icmp_hdr(skb)
;
+
__wsum
csum = 0;
struct sk_buff *skb1;
skb_queue_walk(&icmp_socket->sk->sk_write_queue, skb1) {
struct sk_buff *skb1;
skb_queue_walk(&icmp_socket->sk->sk_write_queue, skb1) {
@@
-382,7
+381,7
@@
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
struct inet_sock *inet = inet_sk(sk);
struct ipcm_cookie ipc;
struct rtable *rt = (struct rtable *)skb->dst;
struct inet_sock *inet = inet_sk(sk);
struct ipcm_cookie ipc;
struct rtable *rt = (struct rtable *)skb->dst;
-
u
32 daddr;
+
__be
32 daddr;
if (ip_options_echo(&icmp_param->replyopts, skb))
return;
if (ip_options_echo(&icmp_param->replyopts, skb))
return;
@@
-393,7
+392,7
@@
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_param->data.icmph.checksum = 0;
icmp_out_count(icmp_param->data.icmph.type);
icmp_param->data.icmph.checksum = 0;
icmp_out_count(icmp_param->data.icmph.type);
- inet->tos =
skb->nh.iph
->tos;
+ inet->tos =
ip_hdr(skb)
->tos;
daddr = ipc.addr = rt->rt_src;
ipc.opt = NULL;
if (icmp_param->replyopts.optlen) {
daddr = ipc.addr = rt->rt_src;
ipc.opt = NULL;
if (icmp_param->replyopts.optlen) {
@@
-405,8
+404,9
@@
static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
struct flowi fl = { .nl_u = { .ip4_u =
{ .daddr = daddr,
.saddr = rt->rt_spec_dst,
struct flowi fl = { .nl_u = { .ip4_u =
{ .daddr = daddr,
.saddr = rt->rt_spec_dst,
- .tos = RT_TOS(
skb->nh.iph
->tos) } },
+ .tos = RT_TOS(
ip_hdr(skb)
->tos) } },
.proto = IPPROTO_ICMP };
.proto = IPPROTO_ICMP };
+ security_skb_classify_flow(skb, &fl);
if (ip_route_output_key(&rt, &fl))
goto out_unlock;
}
if (ip_route_output_key(&rt, &fl))
goto out_unlock;
}
@@
-430,14
+430,14
@@
out_unlock:
* MUST reply to only the first fragment.
*/
* MUST reply to only the first fragment.
*/
-void icmp_send(struct sk_buff *skb_in, int type, int code,
u
32 info)
+void icmp_send(struct sk_buff *skb_in, int type, int code,
__be
32 info)
{
struct iphdr *iph;
int room;
struct icmp_bxm icmp_param;
struct rtable *rt = (struct rtable *)skb_in->dst;
struct ipcm_cookie ipc;
{
struct iphdr *iph;
int room;
struct icmp_bxm icmp_param;
struct rtable *rt = (struct rtable *)skb_in->dst;
struct ipcm_cookie ipc;
-
u
32 saddr;
+
__be
32 saddr;
u8 tos;
if (!rt)
u8 tos;
if (!rt)
@@
-448,9
+448,10
@@
void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
* Check this, icmp_send is called from the most obscure devices
* sometimes.
*/
* Check this, icmp_send is called from the most obscure devices
* sometimes.
*/
- iph =
skb_in->nh.iph
;
+ iph =
ip_hdr(skb_in)
;
- if ((u8 *)iph < skb_in->head || (u8 *)(iph + 1) > skb_in->tail)
+ if ((u8 *)iph < skb_in->head ||
+ (skb_in->network_header + sizeof(*iph)) > skb_in->tail)
goto out;
/*
goto out;
/*
@@
-484,7
+485,7
@@
void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
u8 _inner_type, *itp;
itp = skb_header_pointer(skb_in,
u8 _inner_type, *itp;
itp = skb_header_pointer(skb_in,
- skb_
in->nh.raw
+
+ skb_
network_header(skb_in)
+
(iph->ihl << 2) +
offsetof(struct icmphdr,
type) -
(iph->ihl << 2) +
offsetof(struct icmphdr,
type) -
@@
-536,7
+537,7
@@
void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
icmp_param.data.icmph.un.gateway = info;
icmp_param.data.icmph.checksum = 0;
icmp_param.skb = skb_in;
icmp_param.data.icmph.un.gateway = info;
icmp_param.data.icmph.checksum = 0;
icmp_param.skb = skb_in;
- icmp_param.offset = skb_
in->nh.raw - skb_in->data
;
+ icmp_param.offset = skb_
network_offset(skb_in)
;
icmp_out_count(icmp_param.data.icmph.type);
inet_sk(icmp_socket->sk)->tos = tos;
ipc.addr = iph->saddr;
icmp_out_count(icmp_param.data.icmph.type);
inet_sk(icmp_socket->sk)->tos = tos;
ipc.addr = iph->saddr;
@@
-561,6
+562,7
@@
void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
}
}
};
}
}
};
+ security_skb_classify_flow(skb_in, &fl);
if (ip_route_output_key(&rt, &fl))
goto out_unlock;
}
if (ip_route_output_key(&rt, &fl))
goto out_unlock;
}
@@
-612,7
+614,7
@@
static void icmp_unreach(struct sk_buff *skb)
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto out_err;
if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto out_err;
- icmph =
skb->h.icmph
;
+ icmph =
icmp_hdr(skb)
;
iph = (struct iphdr *)skb->data;
if (iph->ihl < 5) /* Mangled header, drop. */
iph = (struct iphdr *)skb->data;
if (iph->ihl < 5) /* Mangled header, drop. */
@@
-675,7
+677,7
@@
static void icmp_unreach(struct sk_buff *skb)
printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP "
"type %u, code %u "
"error to a broadcast: %u.%u.%u.%u on %s\n",
printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP "
"type %u, code %u "
"error to a broadcast: %u.%u.%u.%u on %s\n",
- NIPQUAD(
skb->nh.iph
->saddr),
+ NIPQUAD(
ip_hdr(skb)
->saddr),
icmph->type, icmph->code,
NIPQUAD(iph->daddr),
skb->dev->name);
icmph->type, icmph->code,
NIPQUAD(iph->daddr),
skb->dev->name);
@@
-742,7
+744,7
@@
static void icmp_redirect(struct sk_buff *skb)
iph = (struct iphdr *)skb->data;
iph = (struct iphdr *)skb->data;
- switch (
skb->h.icmph
->code & 7) {
+ switch (
icmp_hdr(skb)
->code & 7) {
case ICMP_REDIR_NET:
case ICMP_REDIR_NETTOS:
/*
case ICMP_REDIR_NET:
case ICMP_REDIR_NETTOS:
/*
@@
-750,11
+752,11
@@
static void icmp_redirect(struct sk_buff *skb)
*/
case ICMP_REDIR_HOST:
case ICMP_REDIR_HOSTTOS:
*/
case ICMP_REDIR_HOST:
case ICMP_REDIR_HOSTTOS:
- ip_rt_redirect(
skb->nh.iph
->saddr, iph->daddr,
-
skb->h.icmph
->un.gateway,
+ ip_rt_redirect(
ip_hdr(skb)
->saddr, iph->daddr,
+
icmp_hdr(skb)
->un.gateway,
iph->saddr, skb->dev);
break;
iph->saddr, skb->dev);
break;
- }
+ }
out:
return;
out_err:
out:
return;
out_err:
@@
-779,7
+781,7
@@
static void icmp_echo(struct sk_buff *skb)
if (!sysctl_icmp_echo_ignore_all) {
struct icmp_bxm icmp_param;
if (!sysctl_icmp_echo_ignore_all) {
struct icmp_bxm icmp_param;
- icmp_param.data.icmph = *
skb->h.icmph
;
+ icmp_param.data.icmph = *
icmp_hdr(skb)
;
icmp_param.data.icmph.type = ICMP_ECHOREPLY;
icmp_param.skb = skb;
icmp_param.offset = 0;
icmp_param.data.icmph.type = ICMP_ECHOREPLY;
icmp_param.skb = skb;
icmp_param.offset = 0;
@@
-815,7
+817,7
@@
static void icmp_timestamp(struct sk_buff *skb)
icmp_param.data.times[2] = icmp_param.data.times[1];
if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
BUG();
icmp_param.data.times[2] = icmp_param.data.times[1];
if (skb_copy_bits(skb, 0, &icmp_param.data.times[0], 4))
BUG();
- icmp_param.data.icmph = *
skb->h.icmph
;
+ icmp_param.data.icmph = *
icmp_hdr(skb)
;
icmp_param.data.icmph.type = ICMP_TIMESTAMPREPLY;
icmp_param.data.icmph.code = 0;
icmp_param.skb = skb;
icmp_param.data.icmph.type = ICMP_TIMESTAMPREPLY;
icmp_param.data.icmph.code = 0;
icmp_param.skb = skb;
@@
-894,7
+896,7
@@
static void icmp_address_reply(struct sk_buff *skb)
if (in_dev->ifa_list &&
IN_DEV_LOG_MARTIANS(in_dev) &&
IN_DEV_FORWARD(in_dev)) {
if (in_dev->ifa_list &&
IN_DEV_LOG_MARTIANS(in_dev) &&
IN_DEV_FORWARD(in_dev)) {
-
u
32 _mask, *mp;
+
__be
32 _mask, *mp;
mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
BUG_ON(mp == NULL);
mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
BUG_ON(mp == NULL);
@@
-929,8
+931,8
@@
int icmp_rcv(struct sk_buff *skb)
ICMP_INC_STATS_BH(ICMP_MIB_INMSGS);
switch (skb->ip_summed) {
ICMP_INC_STATS_BH(ICMP_MIB_INMSGS);
switch (skb->ip_summed) {
- case CHECKSUM_
HW
:
- if (!
(u16)
csum_fold(skb->csum))
+ case CHECKSUM_
COMPLETE
:
+ if (!csum_fold(skb->csum))
break;
/* fall through */
case CHECKSUM_NONE:
break;
/* fall through */
case CHECKSUM_NONE:
@@
-942,7
+944,7
@@
int icmp_rcv(struct sk_buff *skb)
if (!pskb_pull(skb, sizeof(struct icmphdr)))
goto error;
if (!pskb_pull(skb, sizeof(struct icmphdr)))
goto error;
- icmph =
skb->h.icmph
;
+ icmph =
icmp_hdr(skb)
;
/*
* 18 is the highest 'known' ICMP type. Anything else is a mystery
/*
* 18 is the highest 'known' ICMP type. Anything else is a mystery
@@
-958,7
+960,7
@@
int icmp_rcv(struct sk_buff *skb)
* Parse the ICMP message
*/
* Parse the ICMP message
*/
- if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
+ if (rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {
/*
* RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be
* silently ignored (we let user decide with a sysctl).
/*
* RFC 1122: 3.2.2.6 An ICMP_ECHO to broadcast MAY be
* silently ignored (we let user decide with a sysctl).
@@
-975,7
+977,7
@@
int icmp_rcv(struct sk_buff *skb)
icmph->type != ICMP_ADDRESS &&
icmph->type != ICMP_ADDRESSREPLY) {
goto error;
icmph->type != ICMP_ADDRESS &&
icmph->type != ICMP_ADDRESSREPLY) {
goto error;
- }
+ }
}
ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry);
}
ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry);
@@
-1084,7
+1086,7
@@
static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
.input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard,
},
.input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard,
},
- [ICMP_INFO_REPLY] = {
+ [ICMP_INFO_REPLY] = {
.output_entry = ICMP_MIB_DUMMY,
.input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard,
.output_entry = ICMP_MIB_DUMMY,
.input_entry = ICMP_MIB_DUMMY,
.handler = icmp_discard,