Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315080
b: refs/heads/master
c: f185071
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jul 11, 2012
1 parent 3164f57 commit 4e512b4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 119 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 312487313d4f7177cb751830e3d9c218e42ed59e
refs/heads/master: f185071ddf799e194ba015d040d3d49cdbfa7e48
57 changes: 0 additions & 57 deletions trunk/include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE))

struct fib_nh;
struct inet_peer;
struct fib_info;
struct rtable {
struct dst_entry dst;
Expand All @@ -66,44 +65,9 @@ struct rtable {

/* Miscellaneous cached information */
u32 rt_pmtu;
unsigned long _peer; /* long-living peer info */
struct fib_info *fi; /* for client ref to shared metrics */
};

static inline struct inet_peer *rt_peer_ptr(struct rtable *rt)
{
return inetpeer_ptr(rt->_peer);
}

static inline bool rt_has_peer(struct rtable *rt)
{
return inetpeer_ptr_is_peer(rt->_peer);
}

static inline void __rt_set_peer(struct rtable *rt, struct inet_peer *peer)
{
__inetpeer_ptr_set_peer(&rt->_peer, peer);
}

static inline bool rt_set_peer(struct rtable *rt, struct inet_peer *peer)
{
return inetpeer_ptr_set_peer(&rt->_peer, peer);
}

static inline void rt_init_peer(struct rtable *rt, struct inet_peer_base *base)
{
inetpeer_init_ptr(&rt->_peer, base);
}

static inline void rt_transfer_peer(struct rtable *rt, struct rtable *ort)
{
rt->_peer = ort->_peer;
if (rt_has_peer(ort)) {
struct inet_peer *peer = rt_peer_ptr(ort);
atomic_inc(&peer->refcnt);
}
}

static inline bool rt_is_input_route(const struct rtable *rt)
{
return rt->rt_route_iif != 0;
Expand Down Expand Up @@ -326,27 +290,6 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable
return rt;
}

extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create);

static inline struct inet_peer *__rt_get_peer(struct rtable *rt, __be32 daddr, int create)
{
if (rt_has_peer(rt))
return rt_peer_ptr(rt);

rt_bind_peer(rt, daddr, create);
return (rt_has_peer(rt) ? rt_peer_ptr(rt) : NULL);
}

static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr)
{
return __rt_get_peer(rt, daddr, 0);
}

static inline struct inet_peer *rt_get_peer_create(struct rtable *rt, __be32 daddr)
{
return __rt_get_peer(rt, daddr, 1);
}

static inline int inet_iif(const struct sk_buff *skb)
{
return skb_rtable(skb)->rt_iif;
Expand Down
60 changes: 6 additions & 54 deletions trunk/net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ static void rt_cache_invalidate(struct net *net)

get_random_bytes(&shuffle, sizeof(shuffle));
atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
inetpeer_invalidate_family(AF_INET);
}

/*
Expand Down Expand Up @@ -1216,22 +1215,6 @@ static struct rtable *rt_intern_hash(unsigned int hash, struct rtable *rt,
return rt;
}

void rt_bind_peer(struct rtable *rt, __be32 daddr, int create)
{
struct inet_peer_base *base;
struct inet_peer *peer;

base = inetpeer_base_ptr(rt->_peer);
if (!base)
return;

peer = inet_getpeer_v4(base, daddr, create);
if (peer) {
if (!rt_set_peer(rt, peer))
inet_putpeer(peer);
}
}

/*
* Peer allocation may fail only in serious out-of-memory conditions. However
* we still can generate some output.
Expand Down Expand Up @@ -1588,10 +1571,6 @@ static void ipv4_dst_destroy(struct dst_entry *dst)
fib_info_put(rt->fi);
rt->fi = NULL;
}
if (rt_has_peer(rt)) {
struct inet_peer *peer = rt_peer_ptr(rt);
inet_putpeer(peer);
}
}


Expand Down Expand Up @@ -1711,26 +1690,11 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
struct fib_info *fi)
{
struct inet_peer_base *base;
struct inet_peer *peer;

base = inetpeer_base_ptr(rt->_peer);
BUG_ON(!base);

peer = inet_getpeer_v4(base, rt->rt_dst, 0);
if (peer) {
__rt_set_peer(rt, peer);
if (inet_metrics_new(peer))
memcpy(peer->metrics, fi->fib_metrics,
sizeof(u32) * RTAX_MAX);
dst_init_metrics(&rt->dst, peer->metrics, false);
} else {
if (fi->fib_metrics != (u32 *) dst_default_metrics) {
rt->fi = fi;
atomic_inc(&fi->fib_clntref);
}
dst_init_metrics(&rt->dst, fi->fib_metrics, true);
if (fi->fib_metrics != (u32 *) dst_default_metrics) {
rt->fi = fi;
atomic_inc(&fi->fib_clntref);
}
dst_init_metrics(&rt->dst, fi->fib_metrics, true);
}

static void rt_set_nexthop(struct rtable *rt, const struct flowi4 *fl4,
Expand Down Expand Up @@ -1820,7 +1784,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rt_init_peer(rth, dev_net(dev)->ipv4.peers);
rth->fi = NULL;
if (our) {
rth->dst.input= ip_local_deliver;
Expand Down Expand Up @@ -1946,7 +1909,6 @@ static int __mkroute_input(struct sk_buff *skb,
rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rt_init_peer(rth, &res->table->tb_peers);
rth->fi = NULL;

rth->dst.input = ip_forward;
Expand Down Expand Up @@ -2125,7 +2087,6 @@ out: return err;
rth->rt_mark = skb->mark;
rth->rt_pmtu = 0;
rth->rt_gateway = daddr;
rt_init_peer(rth, net->ipv4.peers);
rth->fi = NULL;
if (res.type == RTN_UNREACHABLE) {
rth->dst.input= ip_error;
Expand Down Expand Up @@ -2323,9 +2284,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
rth->rt_mark = fl4->flowi4_mark;
rth->rt_pmtu = 0;
rth->rt_gateway = fl4->daddr;
rt_init_peer(rth, (res->table ?
&res->table->tb_peers :
dev_net(dev_out)->ipv4.peers));
rth->fi = NULL;

RT_CACHE_STAT_INC(out_slow_tot);
Expand Down Expand Up @@ -2662,7 +2620,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
rt->rt_dst = ort->rt_dst;
rt->rt_src = ort->rt_src;
rt->rt_gateway = ort->rt_gateway;
rt_transfer_peer(rt, ort);
rt->fi = ort->fi;
if (rt->fi)
atomic_inc(&rt->fi->fib_clntref);
Expand Down Expand Up @@ -2700,7 +2657,7 @@ static int rt_fill_info(struct net *net,
struct rtmsg *r;
struct nlmsghdr *nlh;
unsigned long expires = 0;
u32 id = 0, error;
u32 error;

nlh = nlmsg_put(skb, pid, seq, event, sizeof(*r), flags);
if (nlh == NULL)
Expand Down Expand Up @@ -2753,11 +2710,6 @@ static int rt_fill_info(struct net *net,
goto nla_put_failure;

error = rt->dst.error;
if (rt_has_peer(rt)) {
const struct inet_peer *peer = rt_peer_ptr(rt);
inet_peer_refcheck(peer);
id = atomic_read(&peer->ip_id_count) & 0xffff;
}
expires = rt->dst.expires;
if (expires) {
if (time_before(jiffies, expires))
Expand Down Expand Up @@ -2792,7 +2744,7 @@ static int rt_fill_info(struct net *net,
goto nla_put_failure;
}

if (rtnl_put_cacheinfo(skb, &rt->dst, id, expires, error) < 0)
if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
goto nla_put_failure;

return nlmsg_end(skb, nlh);
Expand Down
7 changes: 0 additions & 7 deletions trunk/net/ipv4/xfrm4_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
xdst->u.dst.dev = dev;
dev_hold(dev);

rt_transfer_peer(&xdst->u.rt, rt);

/* Sheit... I remember I did this right. Apparently,
* it was magically lost, so this code needs audit */
xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST |
Expand Down Expand Up @@ -210,11 +208,6 @@ static void xfrm4_dst_destroy(struct dst_entry *dst)

dst_destroy_metrics_generic(dst);

if (rt_has_peer(&xdst->u.rt)) {
struct inet_peer *peer = rt_peer_ptr(&xdst->u.rt);
inet_putpeer(peer);
}

xfrm_dst_destroy(xdst);
}

Expand Down

0 comments on commit 4e512b4

Please sign in to comment.