git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drm/radeon/kms/evergreen: set accel_enabled
[safe/jmp/linux-2.6]
/
net
/
ipv6
/
icmp.c
diff --git
a/net/ipv6/icmp.c
b/net/ipv6/icmp.c
index
a77b8d1
..
ce79929
100644
(file)
--- a/
net/ipv6/icmp.c
+++ b/
net/ipv6/icmp.c
@@
-40,6
+40,7
@@
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/netfilter.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/netfilter.h>
+#include <linux/slab.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
@@
-67,11
+68,6
@@
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/system.h>
-DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics) __read_mostly;
-EXPORT_SYMBOL(icmpv6_statistics);
-DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics) __read_mostly;
-EXPORT_SYMBOL(icmpv6msg_statistics);
-
/*
* The ICMP socket(s). This is the most convenient way to flow control
* our ICMP output as well as maintain a clean interface throughout
/*
* The ICMP socket(s). This is the most convenient way to flow control
* our ICMP output as well as maintain a clean interface throughout
@@
-86,7
+82,7
@@
static inline struct sock *icmpv6_sk(struct net *net)
static int icmpv6_rcv(struct sk_buff *skb);
static int icmpv6_rcv(struct sk_buff *skb);
-static struct inet6_protocol icmpv6_protocol = {
+static
const
struct inet6_protocol icmpv6_protocol = {
.handler = icmpv6_rcv,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
.handler = icmpv6_rcv,
.flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
};
@@
-117,9
+113,9
@@
static __inline__ void icmpv6_xmit_unlock(struct sock *sk)
/*
* Slightly more convenient version of icmpv6_send.
*/
/*
* Slightly more convenient version of icmpv6_send.
*/
-void icmpv6_param_prob(struct sk_buff *skb,
int
code, int pos)
+void icmpv6_param_prob(struct sk_buff *skb,
u8
code, int pos)
{
{
- icmpv6_send(skb, ICMPV6_PARAMPROB, code, pos
, skb->dev
);
+ icmpv6_send(skb, ICMPV6_PARAMPROB, code, pos);
kfree_skb(skb);
}
kfree_skb(skb);
}
@@
-161,7
+157,7
@@
static int is_ineligible(struct sk_buff *skb)
/*
* Check the ICMP output rate limit
*/
/*
* Check the ICMP output rate limit
*/
-static inline int icmpv6_xrlim_allow(struct sock *sk,
int
type,
+static inline int icmpv6_xrlim_allow(struct sock *sk,
u8
type,
struct flowi *fl)
{
struct dst_entry *dst;
struct flowi *fl)
{
struct dst_entry *dst;
@@
-305,8
+301,7
@@
static inline void mip6_addr_swap(struct sk_buff *skb) {}
/*
* Send an ICMP message in response to a packet in error
*/
/*
* Send an ICMP message in response to a packet in error
*/
-void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
- struct net_device *dev)
+void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
{
struct net *net = dev_net(skb->dev);
struct inet6_dev *idev = NULL;
{
struct net *net = dev_net(skb->dev);
struct inet6_dev *idev = NULL;
@@
-323,7
+318,7
@@
void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
int iif = 0;
int addr_type = 0;
int len;
int iif = 0;
int addr_type = 0;
int len;
- int hlimit
, tclass
;
+ int hlimit;
int err = 0;
if ((u8 *)hdr < skb->head ||
int err = 0;
if ((u8 *)hdr < skb->head ||
@@
-427,7
+422,7
@@
void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
/* No need to clone since we're just using its address. */
dst2 = dst;
/* No need to clone since we're just using its address. */
dst2 = dst;
- err = xfrm_lookup(&dst, &fl, sk, 0);
+ err = xfrm_lookup(
net,
&dst, &fl, sk, 0);
switch (err) {
case 0:
if (dst != dst2)
switch (err) {
case 0:
if (dst != dst2)
@@
-443,10
+438,10
@@
void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
goto relookup_failed;
if (xfrm_decode_session_reverse(skb, &fl2, AF_INET6))
goto relookup_failed;
- if (ip6_dst_lookup(sk, &dst2, &fl))
+ if (ip6_dst_lookup(sk, &dst2, &fl
2
))
goto relookup_failed;
goto relookup_failed;
- err = xfrm_lookup(
&dst2, &fl
, sk, XFRM_LOOKUP_ICMP);
+ err = xfrm_lookup(
net, &dst2, &fl2
, sk, XFRM_LOOKUP_ICMP);
switch (err) {
case 0:
dst_release(dst);
switch (err) {
case 0:
dst_release(dst);
@@
-469,10
+464,6
@@
route_done:
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
- tclass = np->tclass;
- if (tclass < 0)
- tclass = 0;
-
msg.skb = skb;
msg.offset = skb_network_offset(skb);
msg.type = type;
msg.skb = skb;
msg.offset = skb_network_offset(skb);
msg.type = type;
@@
-488,10
+479,11
@@
route_done:
err = ip6_append_data(sk, icmpv6_getfrag, &msg,
len + sizeof(struct icmp6hdr),
err = ip6_append_data(sk, icmpv6_getfrag, &msg,
len + sizeof(struct icmp6hdr),
- sizeof(struct icmp6hdr),
-
hlimit,
tclass, NULL, &fl, (struct rt6_info*)dst,
- MSG_DONTWAIT);
+ sizeof(struct icmp6hdr),
hlimit,
+
np->
tclass, NULL, &fl, (struct rt6_info*)dst,
+ MSG_DONTWAIT
, np->dontfrag
);
if (err) {
if (err) {
+ ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
ip6_flush_pending_frames(sk);
goto out_put;
}
ip6_flush_pending_frames(sk);
goto out_put;
}
@@
-522,7
+514,6
@@
static void icmpv6_echo_reply(struct sk_buff *skb)
struct dst_entry *dst;
int err = 0;
int hlimit;
struct dst_entry *dst;
int err = 0;
int hlimit;
- int tclass;
saddr = &ipv6_hdr(skb)->daddr;
saddr = &ipv6_hdr(skb)->daddr;
@@
-552,7
+543,7
@@
static void icmpv6_echo_reply(struct sk_buff *skb)
err = ip6_dst_lookup(sk, &dst, &fl);
if (err)
goto out;
err = ip6_dst_lookup(sk, &dst, &fl);
if (err)
goto out;
- if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
+ if ((err = xfrm_lookup(
net,
&dst, &fl, sk, 0)) < 0)
goto out;
if (ipv6_addr_is_multicast(&fl.fl6_dst))
goto out;
if (ipv6_addr_is_multicast(&fl.fl6_dst))
@@
-562,10
+553,6
@@
static void icmpv6_echo_reply(struct sk_buff *skb)
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
if (hlimit < 0)
hlimit = ip6_dst_hoplimit(dst);
- tclass = np->tclass;
- if (tclass < 0)
- tclass = 0;
-
idev = in6_dev_get(skb->dev);
msg.skb = skb;
idev = in6_dev_get(skb->dev);
msg.skb = skb;
@@
-573,10
+560,12
@@
static void icmpv6_echo_reply(struct sk_buff *skb)
msg.type = ICMPV6_ECHO_REPLY;
err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
msg.type = ICMPV6_ECHO_REPLY;
err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr),
- sizeof(struct icmp6hdr), hlimit, tclass, NULL, &fl,
- (struct rt6_info*)dst, MSG_DONTWAIT);
+ sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl,
+ (struct rt6_info*)dst, MSG_DONTWAIT,
+ np->dontfrag);
if (err) {
if (err) {
+ ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS);
ip6_flush_pending_frames(sk);
goto out_put;
}
ip6_flush_pending_frames(sk);
goto out_put;
}
@@
-590,9
+579,9
@@
out:
icmpv6_xmit_unlock(sk);
}
icmpv6_xmit_unlock(sk);
}
-static void icmpv6_notify(struct sk_buff *skb,
int type, int
code, __be32 info)
+static void icmpv6_notify(struct sk_buff *skb,
u8 type, u8
code, __be32 info)
{
{
- struct inet6_protocol *ipprot;
+
const
struct inet6_protocol *ipprot;
int inner_offset;
int hash;
u8 nexthdr;
int inner_offset;
int hash;
u8 nexthdr;
@@
-643,7
+632,7
@@
static int icmpv6_rcv(struct sk_buff *skb)
struct in6_addr *saddr, *daddr;
struct ipv6hdr *orig_hdr;
struct icmp6hdr *hdr;
struct in6_addr *saddr, *daddr;
struct ipv6hdr *orig_hdr;
struct icmp6hdr *hdr;
-
int
type;
+
u8
type;
if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
struct sec_path *sp = skb_sec_path(skb);
if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
struct sec_path *sp = skb_sec_path(skb);
@@
-914,7
+903,7
@@
static const struct icmp6_err {
},
};
},
};
-int icmpv6_err_convert(
int type, int
code, int *err)
+int icmpv6_err_convert(
u8 type, u8
code, int *err)
{
int fatal = 0;
{
int fatal = 0;
@@
-951,18
+940,16
@@
EXPORT_SYMBOL(icmpv6_err_convert);
#ifdef CONFIG_SYSCTL
ctl_table ipv6_icmp_table_template[] = {
{
#ifdef CONFIG_SYSCTL
ctl_table ipv6_icmp_table_template[] = {
{
- .ctl_name = NET_IPV6_ICMP_RATELIMIT,
.procname = "ratelimit",
.data = &init_net.ipv6.sysctl.icmpv6_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_ms_jiffies,
.procname = "ratelimit",
.data = &init_net.ipv6.sysctl.icmpv6_time,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_ms_jiffies,
- .strategy = sysctl_ms_jiffies
},
},
- {
.ctl_name = 0
},
+ { },
};
};
-struct ctl_table *ipv6_icmp_sysctl_init(struct net *net)
+struct ctl_table *
__net_init
ipv6_icmp_sysctl_init(struct net *net)
{
struct ctl_table *table;
{
struct ctl_table *table;