projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'reset-seq' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libat...
[powerpc.git]
/
net
/
decnet
/
dn_route.c
diff --git
a/net/decnet/dn_route.c
b/net/decnet/dn_route.c
index
49b27a4
..
a8bf106
100644
(file)
--- a/
net/decnet/dn_route.c
+++ b/
net/decnet/dn_route.c
@@
-77,6
+77,7
@@
#include <linux/rcupdate.h>
#include <linux/times.h>
#include <asm/errno.h>
#include <linux/rcupdate.h>
#include <linux/times.h>
#include <asm/errno.h>
+#include <net/netlink.h>
#include <net/neighbour.h>
#include <net/dst.h>
#include <net/flow.h>
#include <net/neighbour.h>
#include <net/dst.h>
#include <net/flow.h>
@@
-167,11
+168,11
@@
static void dn_dst_check_expire(unsigned long dummy)
while((rt=*rtp) != NULL) {
if (atomic_read(&rt->u.dst.__refcnt) ||
(now - rt->u.dst.lastuse) < expire) {
while((rt=*rtp) != NULL) {
if (atomic_read(&rt->u.dst.__refcnt) ||
(now - rt->u.dst.lastuse) < expire) {
- rtp = &rt->u.
rt
_next;
+ rtp = &rt->u.
dst.dn
_next;
continue;
}
continue;
}
- *rtp = rt->u.
rt
_next;
- rt->u.
rt
_next = NULL;
+ *rtp = rt->u.
dst.dn
_next;
+ rt->u.
dst.dn
_next = NULL;
dnrt_free(rt);
}
spin_unlock(&dn_rt_hash_table[i].lock);
dnrt_free(rt);
}
spin_unlock(&dn_rt_hash_table[i].lock);
@@
-198,11
+199,11
@@
static int dn_dst_gc(void)
while((rt=*rtp) != NULL) {
if (atomic_read(&rt->u.dst.__refcnt) ||
(now - rt->u.dst.lastuse) < expire) {
while((rt=*rtp) != NULL) {
if (atomic_read(&rt->u.dst.__refcnt) ||
(now - rt->u.dst.lastuse) < expire) {
- rtp = &rt->u.
rt
_next;
+ rtp = &rt->u.
dst.dn
_next;
continue;
}
continue;
}
- *rtp = rt->u.
rt
_next;
- rt->u.
rt
_next = NULL;
+ *rtp = rt->u.
dst.dn
_next;
+ rt->u.
dst.dn
_next = NULL;
dnrt_drop(rt);
break;
}
dnrt_drop(rt);
break;
}
@@
-286,8
+287,8
@@
static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
while((rth = *rthp) != NULL) {
if (compare_keys(&rth->fl, &rt->fl)) {
/* Put it first */
while((rth = *rthp) != NULL) {
if (compare_keys(&rth->fl, &rt->fl)) {
/* Put it first */
- *rthp = rth->u.
rt
_next;
- rcu_assign_pointer(rth->u.
rt
_next,
+ *rthp = rth->u.
dst.dn
_next;
+ rcu_assign_pointer(rth->u.
dst.dn
_next,
dn_rt_hash_table[hash].chain);
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
dn_rt_hash_table[hash].chain);
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
@@
-300,10
+301,10
@@
static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route *
*rp = rth;
return 0;
}
*rp = rth;
return 0;
}
- rthp = &rth->u.
rt
_next;
+ rthp = &rth->u.
dst.dn
_next;
}
}
- rcu_assign_pointer(rt->u.
rt
_next, dn_rt_hash_table[hash].chain);
+ rcu_assign_pointer(rt->u.
dst.dn
_next, dn_rt_hash_table[hash].chain);
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
dst_hold(&rt->u.dst);
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
dst_hold(&rt->u.dst);
@@
-326,8
+327,8
@@
void dn_run_flush(unsigned long dummy)
goto nothing_to_declare;
for(; rt; rt=next) {
goto nothing_to_declare;
for(; rt; rt=next) {
- next = rt->u.
rt
_next;
- rt->u.
rt
_next = NULL;
+ next = rt->u.
dst.dn
_next;
+ rt->u.
dst.dn
_next = NULL;
dst_free((struct dst_entry *)rt);
}
dst_free((struct dst_entry *)rt);
}
@@
-386,7
+387,7
@@
static int dn_return_short(struct sk_buff *skb)
__le16 tmp;
/* Add back headers */
__le16 tmp;
/* Add back headers */
- skb_push(skb, skb->data - skb
->nh.raw
);
+ skb_push(skb, skb->data - skb
_network_header(skb)
);
if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
@@
-425,7
+426,7
@@
static int dn_return_long(struct sk_buff *skb)
unsigned char tmp[ETH_ALEN];
/* Add back all headers */
unsigned char tmp[ETH_ALEN];
/* Add back all headers */
- skb_push(skb, skb->data - skb
->nh.raw
);
+ skb_push(skb, skb->data - skb
_network_header(skb)
);
if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
if ((skb = skb_unshare(skb, GFP_ATOMIC)) == NULL)
return NET_RX_DROP;
@@
-504,7
+505,7
@@
static int dn_route_rx_long(struct sk_buff *skb)
goto drop_it;
skb_pull(skb, 20);
goto drop_it;
skb_pull(skb, 20);
- skb
->h.raw = skb->data
;
+ skb
_reset_transport_header(skb)
;
/* Destination info */
ptr += 2;
/* Destination info */
ptr += 2;
@@
-542,7
+543,7
@@
static int dn_route_rx_short(struct sk_buff *skb)
goto drop_it;
skb_pull(skb, 5);
goto drop_it;
skb_pull(skb, 5);
- skb
->h.raw = skb->data
;
+ skb
_reset_transport_header(skb)
;
cb->dst = *(__le16 *)ptr;
ptr += 2;
cb->dst = *(__le16 *)ptr;
ptr += 2;
@@
-615,7
+616,7
@@
int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
flags = *skb->data;
}
flags = *skb->data;
}
- skb
->nh.raw = skb->data
;
+ skb
_reset_network_header(skb)
;
/*
* Weed out future version DECnet
/*
* Weed out future version DECnet
@@
-885,7
+886,7
@@
static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
.iif = loopback_dev.ifindex,
.oif = oldflp->oif };
struct dn_route *rt = NULL;
.iif = loopback_dev.ifindex,
.oif = oldflp->oif };
struct dn_route *rt = NULL;
- struct net_device *dev_out = NULL;
+ struct net_device *dev_out = NULL
, *dev
;
struct neighbour *neigh = NULL;
unsigned hash;
unsigned flags = 0;
struct neighbour *neigh = NULL;
unsigned hash;
unsigned flags = 0;
@@
-924,15
+925,17
@@
static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
goto out;
}
read_lock(&dev_base_lock);
goto out;
}
read_lock(&dev_base_lock);
- for
(dev_out = dev_base; dev_out; dev_out = dev_out->next
) {
- if (!dev
_out
->dn_ptr)
+ for
_each_netdev(dev
) {
+ if (!dev->dn_ptr)
continue;
continue;
- if (!dn_dev_islocal(dev
_out
, oldflp->fld_src))
+ if (!dn_dev_islocal(dev, oldflp->fld_src))
continue;
continue;
- if ((dev
_out
->flags & IFF_LOOPBACK) &&
+ if ((dev->flags & IFF_LOOPBACK) &&
oldflp->fld_dst &&
oldflp->fld_dst &&
- !dn_dev_islocal(dev
_out
, oldflp->fld_dst))
+ !dn_dev_islocal(dev, oldflp->fld_dst))
continue;
continue;
+
+ dev_out = dev;
break;
}
read_unlock(&dev_base_lock);
break;
}
read_unlock(&dev_base_lock);
@@
-1169,7
+1172,7
@@
static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl
if (!(flags & MSG_TRYHARD)) {
rcu_read_lock_bh();
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
if (!(flags & MSG_TRYHARD)) {
rcu_read_lock_bh();
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt;
- rt = rcu_dereference(rt->u.
rt
_next)) {
+ rt = rcu_dereference(rt->u.
dst.dn
_next)) {
if ((flp->fld_dst == rt->fl.fld_dst) &&
(flp->fld_src == rt->fl.fld_src) &&
(flp->mark == rt->fl.mark) &&
if ((flp->fld_dst == rt->fl.fld_dst) &&
(flp->fld_src == rt->fl.fld_src) &&
(flp->mark == rt->fl.mark) &&
@@
-1443,7
+1446,7
@@
int dn_route_input(struct sk_buff *skb)
rcu_read_lock();
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
rcu_read_lock();
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
- rt = rcu_dereference(rt->u.
rt
_next)) {
+ rt = rcu_dereference(rt->u.
dst.dn
_next)) {
if ((rt->fl.fld_src == cb->src) &&
(rt->fl.fld_dst == cb->dst) &&
(rt->fl.oif == 0) &&
if ((rt->fl.fld_src == cb->src) &&
(rt->fl.fld_dst == cb->dst) &&
(rt->fl.oif == 0) &&
@@
-1468,7
+1471,7
@@
static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
struct dn_route *rt = (struct dn_route *)skb->dst;
struct rtmsg *r;
struct nlmsghdr *nlh;
struct dn_route *rt = (struct dn_route *)skb->dst;
struct rtmsg *r;
struct nlmsghdr *nlh;
- unsigned char *b = skb
->tail
;
+ unsigned char *b = skb
_tail_pointer(skb)
;
long expires;
nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
long expires;
nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags);
@@
-1509,19
+1512,19
@@
static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
if (rt->fl.iif)
RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
if (rt->fl.iif)
RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif);
- nlh->nlmsg_len = skb
->tail
- b;
+ nlh->nlmsg_len = skb
_tail_pointer(skb)
- b;
return skb->len;
nlmsg_failure:
rtattr_failure:
return skb->len;
nlmsg_failure:
rtattr_failure:
-
skb_trim(skb, b - skb->data
);
+
nlmsg_trim(skb, b
);
return -1;
}
/*
* This is called by both endnodes and routers now.
*/
return -1;
}
/*
* This is called by both endnodes and routers now.
*/
-int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
+
static
int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
{
struct rtattr **rta = arg;
struct rtmsg *rtm = NLMSG_DATA(nlh);
{
struct rtattr **rta = arg;
struct rtmsg *rtm = NLMSG_DATA(nlh);
@@
-1537,7
+1540,7
@@
int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL)
return -ENOBUFS;
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL)
return -ENOBUFS;
- skb
->mac.raw = skb->data
;
+ skb
_reset_mac_header(skb)
;
cb = DN_SKB_CB(skb);
if (rta[RTA_SRC-1])
cb = DN_SKB_CB(skb);
if (rta[RTA_SRC-1])
@@
-1627,7
+1630,7
@@
int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
rcu_read_lock_bh();
for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
rt;
rcu_read_lock_bh();
for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0;
rt;
- rt = rcu_dereference(rt->u.
rt
_next), idx++) {
+ rt = rcu_dereference(rt->u.
dst.dn
_next), idx++) {
if (idx < s_idx)
continue;
skb->dst = dst_clone(&rt->u.dst);
if (idx < s_idx)
continue;
skb->dst = dst_clone(&rt->u.dst);
@@
-1673,7
+1676,7
@@
static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
{
struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private);
{
struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private);
- rt = rt->u.
rt
_next;
+ rt = rt->u.
dst.dn
_next;
while(!rt) {
rcu_read_unlock_bh();
if (--s->bucket < 0)
while(!rt) {
rcu_read_unlock_bh();
if (--s->bucket < 0)
@@
-1751,7
+1754,7
@@
out_kfree:
goto out;
}
goto out;
}
-static struct file_operations dn_rt_cache_seq_fops = {
+static
const
struct file_operations dn_rt_cache_seq_fops = {
.owner = THIS_MODULE,
.open = dn_rt_cache_seq_open,
.read = seq_read,
.owner = THIS_MODULE,
.open = dn_rt_cache_seq_open,
.read = seq_read,
@@
-1812,6
+1815,13
@@
void __init dn_route_init(void)
dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
dn_dst_ops.gc_thresh = (dn_rt_hash_mask + 1);
proc_net_fops_create("decnet_cache", S_IRUGO, &dn_rt_cache_seq_fops);
+
+#ifdef CONFIG_DECNET_ROUTER
+ rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute, dn_fib_dump);
+#else
+ rtnl_register(PF_DECnet, RTM_GETROUTE, dn_cache_getroute,
+ dn_cache_dump);
+#endif
}
void __exit dn_route_cleanup(void)
}
void __exit dn_route_cleanup(void)