Commit 91837979 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/home/davem/src/BK/net-2.5

into kernel.bkbits.net:/home/davem/net-2.5
parents d691958b 7aeb5c3f
...@@ -619,6 +619,37 @@ ratelimit - INTEGER ...@@ -619,6 +619,37 @@ ratelimit - INTEGER
0 to disable any limiting, otherwise the maximal rate in jiffies(1) 0 to disable any limiting, otherwise the maximal rate in jiffies(1)
Default: 100 Default: 100
use_tempaddr - INTEGER
Preference for Privacy Extensions (RFC3041).
<= 0 : disable Privacy Extensions
== 1 : enable Privacy Extensions, but prefer public
addresses over temporary addresses.
> 1 : enable Privacy Extensions and prefer temporary
addresses over public addresses.
Default: 0 (for most devices)
-1 (for point-to-point devices and loopback devices)
temp_valid_lft - INTEGER
valid lifetime (in seconds) for temporary addresses.
Default: 604800 (7 days)
temp_prefered_lft - INTEGER
Preferred lifetime (in seconds) for temorary addresses.
Default: 86400 (1 day)
max_desync_factor - INTEGER
Maximum value for DESYNC_FACTOR, which is a random value
that ensures that clients don't synchronize with each
other and generage new addresses at exactly the same time.
value is in seconds.
Default: 600
regen_max_retry - INTEGER
Number of attempts before give up attempting to generate
valid temporary addresses.
Default: 5
IPv6 Update by: IPv6 Update by:
Pekka Savola <pekkas@netcore.fi> Pekka Savola <pekkas@netcore.fi>
YOSHIFUJI Hideaki / USAGI Project <yoshfuji@linux-ipv6.org> YOSHIFUJI Hideaki / USAGI Project <yoshfuji@linux-ipv6.org>
......
...@@ -1262,6 +1262,8 @@ P: Alexey Kuznetsov ...@@ -1262,6 +1262,8 @@ P: Alexey Kuznetsov
M: kuznet@ms2.inr.ac.ru M: kuznet@ms2.inr.ac.ru
P: Pekka Savola (ipv6) P: Pekka Savola (ipv6)
M: pekkas@netcore.fi M: pekkas@netcore.fi
P: James Morris
M: jmorris@intercode.com.au
L: netdev@oss.sgi.com L: netdev@oss.sgi.com
S: Maintained S: Maintained
......
...@@ -336,6 +336,7 @@ enum ...@@ -336,6 +336,7 @@ enum
/* ifa_flags */ /* ifa_flags */
#define IFA_F_SECONDARY 0x01 #define IFA_F_SECONDARY 0x01
#define IFA_F_TEMPORARY IFA_F_SECONDARY
#define IFA_F_DEPRECATED 0x20 #define IFA_F_DEPRECATED 0x20
#define IFA_F_TENTATIVE 0x40 #define IFA_F_TENTATIVE 0x40
......
...@@ -777,7 +777,7 @@ static inline int skb_is_nonlinear(const struct sk_buff *skb) ...@@ -777,7 +777,7 @@ static inline int skb_is_nonlinear(const struct sk_buff *skb)
return skb->data_len; return skb->data_len;
} }
static inline int skb_headlen(const struct sk_buff *skb) static inline unsigned int skb_headlen(const struct sk_buff *skb)
{ {
return skb->len - skb->data_len; return skb->len - skb->data_len;
} }
......
...@@ -388,7 +388,12 @@ enum { ...@@ -388,7 +388,12 @@ enum {
NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_DAD_TRANSMITS=7,
NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICITS=8,
NET_IPV6_RTR_SOLICIT_INTERVAL=9, NET_IPV6_RTR_SOLICIT_INTERVAL=9,
NET_IPV6_RTR_SOLICIT_DELAY=10 NET_IPV6_RTR_SOLICIT_DELAY=10,
NET_IPV6_USE_TEMPADDR=11,
NET_IPV6_TEMP_VALID_LFT=12,
NET_IPV6_TEMP_PREFERED_LFT=13,
NET_IPV6_REGEN_MAX_RETRY=14,
NET_IPV6_MAX_DESYNC_FACTOR=15
}; };
/* /proc/sys/net/ipv6/icmp */ /* /proc/sys/net/ipv6/icmp */
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
#define MAX_RTR_SOLICITATIONS 3 #define MAX_RTR_SOLICITATIONS 3
#define RTR_SOLICITATION_INTERVAL (4*HZ) #define RTR_SOLICITATION_INTERVAL (4*HZ)
#define TEMP_VALID_LIFETIME (7*86400)
#define TEMP_PREFERRED_LIFETIME (86400)
#define REGEN_MAX_RETRY (5)
#define MAX_DESYNC_FACTOR (600)
#define ADDR_CHECK_FREQUENCY (120*HZ) #define ADDR_CHECK_FREQUENCY (120*HZ)
struct prefix_info { struct prefix_info {
......
...@@ -43,6 +43,12 @@ struct inet6_ifaddr ...@@ -43,6 +43,12 @@ struct inet6_ifaddr
struct inet6_ifaddr *lst_next; /* next addr in addr_lst */ struct inet6_ifaddr *lst_next; /* next addr in addr_lst */
struct inet6_ifaddr *if_next; /* next addr in inet6_dev */ struct inet6_ifaddr *if_next; /* next addr in inet6_dev */
#ifdef CONFIG_IPV6_PRIVACY
struct inet6_ifaddr *tmp_next; /* next addr in tempaddr_lst */
struct inet6_ifaddr *ifpub;
int regen_count;
#endif
int dead; int dead;
}; };
...@@ -86,7 +92,13 @@ struct ipv6_devconf ...@@ -86,7 +92,13 @@ struct ipv6_devconf
int rtr_solicits; int rtr_solicits;
int rtr_solicit_interval; int rtr_solicit_interval;
int rtr_solicit_delay; int rtr_solicit_delay;
#ifdef CONFIG_IPV6_PRIVACY
int use_tempaddr;
int temp_valid_lft;
int temp_prefered_lft;
int regen_max_retry;
int max_desync_factor;
#endif
void *sysctl; void *sysctl;
}; };
...@@ -101,6 +113,13 @@ struct inet6_dev ...@@ -101,6 +113,13 @@ struct inet6_dev
__u32 if_flags; __u32 if_flags;
int dead; int dead;
#ifdef CONFIG_IPV6_PRIVACY
u8 rndid[8];
u8 entropy[8];
struct timer_list regen_timer;
struct inet6_ifaddr *tempaddr_list;
#endif
struct neigh_parms *nd_parms; struct neigh_parms *nd_parms;
struct inet6_dev *next; struct inet6_dev *next;
struct ipv6_devconf cnf; struct ipv6_devconf cnf;
......
...@@ -30,6 +30,8 @@ extern void ip6_route_input(struct sk_buff *skb); ...@@ -30,6 +30,8 @@ extern void ip6_route_input(struct sk_buff *skb);
extern struct dst_entry * ip6_route_output(struct sock *sk, extern struct dst_entry * ip6_route_output(struct sock *sk,
struct flowi *fl); struct flowi *fl);
extern int ip6_route_me_harder(struct sk_buff *skb);
extern void ip6_route_init(void); extern void ip6_route_init(void);
extern void ip6_route_cleanup(void); extern void ip6_route_cleanup(void);
......
This diff is collapsed.
...@@ -98,7 +98,7 @@ struct lec_priv { ...@@ -98,7 +98,7 @@ struct lec_priv {
establishes multiple Multicast Forward VCCs to us. This list establishes multiple Multicast Forward VCCs to us. This list
collects all those VCCs. LANEv1 client has only one item in this collects all those VCCs. LANEv1 client has only one item in this
list. These entries are not aged out. */ list. These entries are not aged out. */
atomic_t lec_arp_lock_var; atomic_t lec_arp_users;
struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */ struct atm_vcc *mcast_vcc; /* Default Multicast Send VCC */
struct atm_vcc *lecd; struct atm_vcc *lecd;
struct timer_list lec_arp_timer; struct timer_list lec_arp_timer;
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/init.h>
#include <net/sock.h> #include <net/sock.h>
#include <asm/system.h> #include <asm/system.h>
......
...@@ -223,57 +223,28 @@ struct icmp_control { ...@@ -223,57 +223,28 @@ struct icmp_control {
static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1]; static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];
/* /*
* The ICMP socket. This is the most convenient way to flow control * The ICMP socket(s). This is the most convenient way to flow control
* our ICMP output as well as maintain a clean interface throughout * our ICMP output as well as maintain a clean interface throughout
* all layers. All Socketless IP sends will soon be gone. * all layers. All Socketless IP sends will soon be gone.
*
* On SMP we have one ICMP socket per-cpu.
*/ */
struct socket *icmp_socket; static DEFINE_PER_CPU(struct socket *, __icmp_socket) = NULL;
#define icmp_socket per_cpu(__icmp_socket, smp_processor_id())
/* ICMPv4 socket is only a bit non-reenterable (unlike ICMPv6,
which is strongly non-reenterable). A bit later it will be made
reenterable and the lock may be removed then.
*/
static int icmp_xmit_holder = -1;
static int icmp_xmit_lock_bh(void)
{
int rc;
if (!spin_trylock(&icmp_socket->sk->lock.slock)) {
rc = -EAGAIN;
if (icmp_xmit_holder == smp_processor_id())
goto out;
spin_lock(&icmp_socket->sk->lock.slock);
}
rc = 0;
icmp_xmit_holder = smp_processor_id();
out:
return rc;
}
static __inline__ int icmp_xmit_lock(void) static __inline__ void icmp_xmit_lock(void)
{ {
int ret;
local_bh_disable(); local_bh_disable();
ret = icmp_xmit_lock_bh();
if (ret)
local_bh_enable();
return ret;
}
static void icmp_xmit_unlock_bh(void) if (unlikely(!spin_trylock(&icmp_socket->sk->lock.slock)))
{ BUG();
icmp_xmit_holder = -1;
spin_unlock(&icmp_socket->sk->lock.slock);
} }
static __inline__ void icmp_xmit_unlock(void) static void icmp_xmit_unlock(void)
{ {
icmp_xmit_unlock_bh(); spin_unlock_bh(&icmp_socket->sk->lock.slock);
local_bh_enable();
} }
/* /*
* Send an ICMP frame. * Send an ICMP frame.
*/ */
...@@ -404,10 +375,11 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) ...@@ -404,10 +375,11 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
struct rtable *rt = (struct rtable *)skb->dst; struct rtable *rt = (struct rtable *)skb->dst;
u32 daddr; u32 daddr;
if (ip_options_echo(&icmp_param->replyopts, skb) || if (ip_options_echo(&icmp_param->replyopts, skb))
icmp_xmit_lock_bh())
goto out; goto out;
icmp_xmit_lock();
icmp_param->data.icmph.checksum = 0; icmp_param->data.icmph.checksum = 0;
icmp_out_count(icmp_param->data.icmph.type); icmp_out_count(icmp_param->data.icmph.type);
...@@ -434,7 +406,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) ...@@ -434,7 +406,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
icmp_push_reply(icmp_param, &ipc, rt); icmp_push_reply(icmp_param, &ipc, rt);
ip_rt_put(rt); ip_rt_put(rt);
out_unlock: out_unlock:
icmp_xmit_unlock_bh(); icmp_xmit_unlock();
out:; out:;
} }
...@@ -519,8 +491,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info) ...@@ -519,8 +491,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info)
} }
} }
if (icmp_xmit_lock()) icmp_xmit_lock();
goto out;
/* /*
* Construct source address and options. * Construct source address and options.
...@@ -1141,13 +1112,23 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = { ...@@ -1141,13 +1112,23 @@ static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
void __init icmp_init(struct net_proto_family *ops) void __init icmp_init(struct net_proto_family *ops)
{ {
struct inet_opt *inet; struct inet_opt *inet;
int err = sock_create(PF_INET, SOCK_RAW, IPPROTO_ICMP, &icmp_socket); int i;
for (i = 0; i < NR_CPUS; i++) {
int err;
if (!cpu_possible(i))
continue;
err = sock_create(PF_INET, SOCK_RAW, IPPROTO_ICMP,
&per_cpu(__icmp_socket, i));
if (err < 0) if (err < 0)
panic("Failed to create the ICMP control socket.\n"); panic("Failed to create the ICMP control socket.\n");
icmp_socket->sk->allocation = GFP_ATOMIC;
icmp_socket->sk->sndbuf = SK_WMEM_MAX * 2; per_cpu(__icmp_socket, i)->sk->allocation = GFP_ATOMIC;
inet = inet_sk(icmp_socket->sk); per_cpu(__icmp_socket, i)->sk->sndbuf = SK_WMEM_MAX * 2;
inet = inet_sk(per_cpu(__icmp_socket, i)->sk);
inet->ttl = MAXTTL; inet->ttl = MAXTTL;
inet->pmtudisc = IP_PMTUDISC_DONT; inet->pmtudisc = IP_PMTUDISC_DONT;
...@@ -1155,5 +1136,6 @@ void __init icmp_init(struct net_proto_family *ops) ...@@ -1155,5 +1136,6 @@ void __init icmp_init(struct net_proto_family *ops)
* see it, we do not wish this socket to see incoming * see it, we do not wish this socket to see incoming
* packets. * packets.
*/ */
icmp_socket->sk->prot->unhash(icmp_socket->sk); per_cpu(__icmp_socket, i)->sk->prot->unhash(per_cpu(__icmp_socket, i)->sk);
}
} }
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
* - export ip_conntrack[_expect]_{find_get,put} functions * - export ip_conntrack[_expect]_{find_get,put} functions
* */ * */
#ifdef MODULE
#define __NO_VERSION__
#endif
#include <linux/version.h> #include <linux/version.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
......
#define __NO_VERSION__
#include <linux/types.h> #include <linux/types.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/timer.h> #include <linux/timer.h>
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
/* (c) 1999 Paul `Rusty' Russell. Licenced under the GNU General /* (c) 1999 Paul `Rusty' Russell. Licenced under the GNU General
Public Licence. */ Public Licence. */
#ifdef MODULE
#define __NO_VERSION__
#endif
#include <linux/version.h> #include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
......
/* Everything about the rules for NAT. */ /* Everything about the rules for NAT. */
#define __NO_VERSION__
#include <linux/types.h> #include <linux/types.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/netfilter.h> #include <linux/netfilter.h>
......
# #
# IPv6 configuration # IPv6 configuration
# #
config IPV6_PRIVACY
bool "IPv6: Privacy Extensions (RFC 3041) support"
depends on IPV6
---help---
Privacy Extensions for Stateless Address Autoconfiguration in IPv6
support. With this option, additional periodically-alter
pseudo-random global-scope unicast address(es) will assigned to
your interface(s).
By default, kernel do not generate temporary addresses.
To use temporary addresses, do
echo 2 >/proc/sys/net/ipv6/conf/all/use_tempaddr
See <file:Documentation/networking/ip-sysctl.txt> for details.
source "net/ipv6/netfilter/Kconfig" source "net/ipv6/netfilter/Kconfig"
This diff is collapsed.
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* YOSHIFUJI Hideaki @USAGI: added sysctl for icmp rate limit. * YOSHIFUJI Hideaki @USAGI: added sysctl for icmp rate limit.
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -68,10 +67,12 @@ ...@@ -68,10 +67,12 @@
DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
/* /*
* ICMP socket for flow control. * ICMP socket(s) for flow control.
*/ */
struct socket *icmpv6_socket; /* XXX We can't use per_cpu because this can be modular... */
static struct socket *__icmpv6_socket[NR_CPUS];
#define icmpv6_socket __icmpv6_socket[smp_processor_id()]
static int icmpv6_rcv(struct sk_buff *skb); static int icmpv6_rcv(struct sk_buff *skb);
...@@ -88,40 +89,16 @@ struct icmpv6_msg { ...@@ -88,40 +89,16 @@ struct icmpv6_msg {
__u32 csum; __u32 csum;
}; };
static __inline__ void icmpv6_xmit_lock(void)
static int icmpv6_xmit_holder = -1;
static int icmpv6_xmit_lock_bh(void)
{
if (!spin_trylock(&icmpv6_socket->sk->lock.slock)) {
if (icmpv6_xmit_holder == smp_processor_id())
return -EAGAIN;
spin_lock(&icmpv6_socket->sk->lock.slock);
}
icmpv6_xmit_holder = smp_processor_id();
return 0;
}
static __inline__ int icmpv6_xmit_lock(void)
{ {
int ret;
local_bh_disable(); local_bh_disable();
ret = icmpv6_xmit_lock_bh(); if (unlikely(!spin_trylock(&icmpv6_socket->sk->lock.slock)))
if (ret) BUG();
local_bh_enable();
return ret;
}
static void icmpv6_xmit_unlock_bh(void)
{
icmpv6_xmit_holder = -1;
spin_unlock(&icmpv6_socket->sk->lock.slock);
} }
static __inline__ void icmpv6_xmit_unlock(void) static __inline__ void icmpv6_xmit_unlock(void)
{ {
icmpv6_xmit_unlock_bh(); spin_unlock_bh(&icmpv6_socket->sk->lock.slock);
local_bh_enable();
} }
...@@ -342,8 +319,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, ...@@ -342,8 +319,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
fl.uli_u.icmpt.type = type; fl.uli_u.icmpt.type = type;
fl.uli_u.icmpt.code = code; fl.uli_u.icmpt.code = code;
if (icmpv6_xmit_lock()) icmpv6_xmit_lock();
return;
if (!icmpv6_xrlim_allow(sk, type, &fl)) if (!icmpv6_xrlim_allow(sk, type, &fl))
goto out; goto out;
...@@ -416,15 +392,14 @@ static void icmpv6_echo_reply(struct sk_buff *skb) ...@@ -416,15 +392,14 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
fl.uli_u.icmpt.type = ICMPV6_ECHO_REPLY; fl.uli_u.icmpt.type = ICMPV6_ECHO_REPLY;
fl.uli_u.icmpt.code = 0; fl.uli_u.icmpt.code = 0;
if (icmpv6_xmit_lock_bh()) icmpv6_xmit_lock();
return;
ip6_build_xmit(sk, icmpv6_getfrag, &msg, &fl, msg.len, NULL, -1, ip6_build_xmit(sk, icmpv6_getfrag, &msg, &fl, msg.len, NULL, -1,
MSG_DONTWAIT); MSG_DONTWAIT);
ICMP6_INC_STATS_BH(Icmp6OutEchoReplies); ICMP6_INC_STATS_BH(Icmp6OutEchoReplies);
ICMP6_INC_STATS_BH(Icmp6OutMsgs); ICMP6_INC_STATS_BH(Icmp6OutMsgs);
icmpv6_xmit_unlock_bh(); icmpv6_xmit_unlock();
} }
static void icmpv6_notify(struct sk_buff *skb, int type, int code, u32 info) static void icmpv6_notify(struct sk_buff *skb, int type, int code, u32 info)
...@@ -627,26 +602,47 @@ static int icmpv6_rcv(struct sk_buff *skb) ...@@ -627,26 +602,47 @@ static int icmpv6_rcv(struct sk_buff *skb)
int __init icmpv6_init(struct net_proto_family *ops) int __init icmpv6_init(struct net_proto_family *ops)
{ {
struct sock *sk; struct sock *sk;
int i;
for (i = 0; i < NR_CPUS; i++) {
int err; int err;
err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, &icmpv6_socket); if (!cpu_possible(i))
continue;
err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6,
&__icmpv6_socket[i]);
if (err < 0) { if (err < 0) {
int j;
printk(KERN_ERR printk(KERN_ERR
"Failed to initialize the ICMP6 control socket (err %d).\n", "Failed to initialize the ICMP6 control socket "
"(err %d).\n",
err); err);
icmpv6_socket = NULL; /* for safety */ for (j = 0; j < i; j++) {
if (!cpu_possible(j))
continue;
sock_release(__icmpv6_socket[j]);
__icmpv6_socket[j] = NULL; /* for safety */
}
return err; return err;
} }
sk = icmpv6_socket->sk; sk = __icmpv6_socket[i]->sk;
sk->allocation = GFP_ATOMIC; sk->allocation = GFP_ATOMIC;
sk->sndbuf = SK_WMEM_MAX*2; sk->sndbuf = SK_WMEM_MAX*2;
sk->prot->unhash(sk); sk->prot->unhash(sk);
}
if (inet6_add_protocol(&icmpv6_protocol, IPPROTO_ICMPV6) < 0) { if (inet6_add_protocol(&icmpv6_protocol, IPPROTO_ICMPV6) < 0) {
printk(KERN_ERR "Failed to register ICMP6 protocol\n"); printk(KERN_ERR "Failed to register ICMP6 protocol\n");
sock_release(icmpv6_socket); for (i = 0; i < NR_CPUS; i++) {
icmpv6_socket = NULL; if (!cpu_possible(i))
continue;
sock_release(__icmpv6_socket[i]);
__icmpv6_socket[i] = NULL;
}
return -EAGAIN; return -EAGAIN;
} }
...@@ -655,8 +651,14 @@ int __init icmpv6_init(struct net_proto_family *ops) ...@@ -655,8 +651,14 @@ int __init icmpv6_init(struct net_proto_family *ops)
void icmpv6_cleanup(void) void icmpv6_cleanup(void)
{ {
sock_release(icmpv6_socket); int i;
icmpv6_socket = NULL; /* For safety. */
for (i = 0; i < NR_CPUS; i++) {
if (!cpu_possible(i))
continue;
sock_release(__icmpv6_socket[i]);
__icmpv6_socket[i] = NULL; /* For safety. */
}
inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);
} }
......
...@@ -134,7 +134,7 @@ int ip6_output(struct sk_buff *skb) ...@@ -134,7 +134,7 @@ int ip6_output(struct sk_buff *skb)
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
static int route6_me_harder(struct sk_buff *skb) int ip6_route_me_harder(struct sk_buff *skb)
{ {
struct ipv6hdr *iph = skb->nh.ipv6h; struct ipv6hdr *iph = skb->nh.ipv6h;
struct dst_entry *dst; struct dst_entry *dst;
...@@ -152,7 +152,7 @@ static int route6_me_harder(struct sk_buff *skb) ...@@ -152,7 +152,7 @@ static int route6_me_harder(struct sk_buff *skb)
if (dst->error) { if (dst->error) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_DEBUG "route6_me_harder: No more route.\n"); printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -168,7 +168,7 @@ static inline int ip6_maybe_reroute(struct sk_buff *skb) ...@@ -168,7 +168,7 @@ static inline int ip6_maybe_reroute(struct sk_buff *skb)
{ {
#ifdef CONFIG_NETFILTER #ifdef CONFIG_NETFILTER
if (skb->nfcache & NFC_ALTERED){ if (skb->nfcache & NFC_ALTERED){
if (route6_me_harder(skb) != 0){ if (ip6_route_me_harder(skb) != 0){
kfree_skb(skb); kfree_skb(skb);
return -EINVAL; return -EINVAL;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
* o Return an optlen of the truncated length if need be * o Return an optlen of the truncated length if need be
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/errno.h> #include <linux/errno.h>
......
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <net/protocol.h> #include <net/protocol.h>
#include <net/ipv6.h> #include <net/ipv6.h>
...@@ -11,6 +12,9 @@ EXPORT_SYMBOL(ndisc_mc_map); ...@@ -11,6 +12,9 @@ EXPORT_SYMBOL(ndisc_mc_map);
EXPORT_SYMBOL(register_inet6addr_notifier); EXPORT_SYMBOL(register_inet6addr_notifier);
EXPORT_SYMBOL(unregister_inet6addr_notifier); EXPORT_SYMBOL(unregister_inet6addr_notifier);
EXPORT_SYMBOL(ip6_route_output); EXPORT_SYMBOL(ip6_route_output);
#ifdef CONFIG_NETFILTER
EXPORT_SYMBOL(ip6_route_me_harder);
#endif
EXPORT_SYMBOL(addrconf_lock); EXPORT_SYMBOL(addrconf_lock);
EXPORT_SYMBOL(ipv6_setsockopt); EXPORT_SYMBOL(ipv6_setsockopt);
EXPORT_SYMBOL(ipv6_getsockopt); EXPORT_SYMBOL(ipv6_getsockopt);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
* - MLD for link-local addresses. * - MLD for link-local addresses.
*/ */
#define __NO_VERSION__
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#define ND_PRINTK2 ND_PRINTK #define ND_PRINTK2 ND_PRINTK
#endif #endif
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -326,45 +326,6 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, void *data) ...@@ -326,45 +326,6 @@ ipq_enqueue_packet(struct sk_buff *skb, struct nf_info *info, void *data)
return status; return status;
} }
/*
* Taken from net/ipv6/ip6_output.c
*
* We should use the one there, but is defined static
* so we put this just here and let the things as
* they are now.
*
* If that one is modified, this one should be modified too.
*/
static int
route6_me_harder(struct sk_buff *skb)
{
struct ipv6hdr *iph = skb->nh.ipv6h;
struct dst_entry *dst;
struct flowi fl;
fl.proto = iph->nexthdr;
fl.fl6_dst = &iph->daddr;
fl.fl6_src = &iph->saddr;
fl.oif = skb->sk ? skb->sk->bound_dev_if : 0;
fl.fl6_flowlabel = 0;
fl.uli_u.ports.dport = 0;
fl.uli_u.ports.sport = 0;
dst = ip6_route_output(skb->sk, &fl);
if (dst->error) {
if (net_ratelimit())
printk(KERN_DEBUG "route6_me_harder: No more route.\n");
return -EINVAL;
}
/* Drop old route. */
dst_release(skb->dst);
skb->dst = dst;
return 0;
}
static int static int
ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
{ {
...@@ -410,7 +371,7 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e) ...@@ -410,7 +371,7 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct ipq_queue_entry *e)
struct ipv6hdr *iph = e->skb->nh.ipv6h; struct ipv6hdr *iph = e->skb->nh.ipv6h;
if (ipv6_addr_cmp(&iph->daddr, &e->rt_info.daddr) || if (ipv6_addr_cmp(&iph->daddr, &e->rt_info.daddr) ||
ipv6_addr_cmp(&iph->saddr, &e->rt_info.saddr)) ipv6_addr_cmp(&iph->saddr, &e->rt_info.saddr))
return route6_me_harder(e->skb); return ip6_route_me_harder(e->skb);
} }
return 0; return 0;
} }
......
...@@ -574,15 +574,17 @@ static int ip6_dst_gc() ...@@ -574,15 +574,17 @@ static int ip6_dst_gc()
Remove it only when all the things will work! Remove it only when all the things will work!
*/ */
static void ipv6_wash_prefix(struct in6_addr *pfx, int plen) static void ipv6_addr_prefix(struct in6_addr *pfx,
const struct in6_addr *addr, int plen)
{ {
int b = plen&0x7; int b = plen&0x7;
int o = (plen + 7)>>3; int o = plen>>3;
memcpy(pfx->s6_addr, addr, o);
if (o < 16) if (o < 16)
memset(pfx->s6_addr + o, 0, 16 - o); memset(pfx->s6_addr + o, 0, 16 - o);
if (b != 0) if (b != 0)
pfx->s6_addr[plen>>3] &= (0xFF<<(8-b)); pfx->s6_addr[o] = addr->s6_addr[o]&(0xff00 >> b);
} }
static int ipv6_get_mtu(struct net_device *dev) static int ipv6_get_mtu(struct net_device *dev)
...@@ -655,16 +657,16 @@ int ip6_route_add(struct in6_rtmsg *rtmsg) ...@@ -655,16 +657,16 @@ int ip6_route_add(struct in6_rtmsg *rtmsg)
goto out; goto out;
} }
ipv6_addr_copy(&rt->rt6i_dst.addr, &rtmsg->rtmsg_dst); ipv6_addr_prefix(&rt->rt6i_dst.addr,
&rtmsg->rtmsg_dst, rtmsg->rtmsg_dst_len);
rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len; rt->rt6i_dst.plen = rtmsg->rtmsg_dst_len;
if (rt->rt6i_dst.plen == 128) if (rt->rt6i_dst.plen == 128)
rt->u.dst.flags = DST_HOST; rt->u.dst.flags = DST_HOST;
ipv6_wash_prefix(&rt->rt6i_dst.addr, rt->rt6i_dst.plen);
#ifdef CONFIG_IPV6_SUBTREES #ifdef CONFIG_IPV6_SUBTREES
ipv6_addr_copy(&rt->rt6i_src.addr, &rtmsg->rtmsg_src); ipv6_addr_prefix(&rt->rt6i_src.addr,
&rtmsg->rtmsg_src, rtmsg->rtmsg_src_len);
rt->rt6i_src.plen = rtmsg->rtmsg_src_len; rt->rt6i_src.plen = rtmsg->rtmsg_src_len;
ipv6_wash_prefix(&rt->rt6i_src.addr, rt->rt6i_src.plen);
#endif #endif
rt->rt6i_metric = rtmsg->rtmsg_metric; rt->rt6i_metric = rtmsg->rtmsg_metric;
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
* Nate Thompson <nate@thebog.net>: 6to4 support * Nate Thompson <nate@thebog.net>: 6to4 support
*/ */
#define __NO_VERSION__
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/errno.h> #include <linux/errno.h>
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -585,6 +585,16 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code) ...@@ -585,6 +585,16 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
read_unlock(&nl_table_lock); read_unlock(&nl_table_lock);
} }
static inline void netlink_rcv_wake(struct sock *sk)
{
struct netlink_opt *nlk = nlk_sk(sk);
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
}
static int netlink_sendmsg(struct kiocb *iocb, struct socket *sock, static int netlink_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, struct msghdr *msg, int len,
struct scm_cookie *scm) struct scm_cookie *scm)
...@@ -706,12 +716,7 @@ static int netlink_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -706,12 +716,7 @@ static int netlink_recvmsg(struct kiocb *iocb, struct socket *sock,
netlink_dump(sk); netlink_dump(sk);
out: out:
if (skb_queue_len(&sk->receive_queue) <= sk->rcvbuf/2) { netlink_rcv_wake(sk);
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
}
return err ? : copied; return err ? : copied;
} }
...@@ -721,13 +726,7 @@ void netlink_data_ready(struct sock *sk, int len) ...@@ -721,13 +726,7 @@ void netlink_data_ready(struct sock *sk, int len)
if (nlk->data_ready) if (nlk->data_ready)
nlk->data_ready(sk, len); nlk->data_ready(sk, len);
netlink_rcv_wake(sk);
if (skb_queue_len(&sk->receive_queue) <= sk->rcvbuf/2) {
if (skb_queue_len(&sk->receive_queue) == 0)
clear_bit(0, &nlk->state);
if (!test_bit(0, &nlk->state))
wake_up_interruptible(&nlk->wait);
}
} }
/* /*
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Copyright Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) * Copyright Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
*/ */
#include <linux/config.h> #include <linux/config.h>
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
*/ */
#include <linux/config.h> #include <linux/config.h>
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
* be incorporated into the next SCTP release. * be incorporated into the next SCTP release.
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
......
#define __NO_VERSION__
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
*/ */
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* Copyright (C) 1997 Olaf Kirch <okir@monad.swb.de> * Copyright (C) 1997 Olaf Kirch <okir@monad.swb.de>
*/ */
#define __NO_VERSION__
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#define __NO_VERSION__
#include <linux/module.h> #include <linux/module.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment