Skip to content

Commit

Permalink
inetpeer: Mark metrics as "new" in fresh inetpeer entries.
Browse files Browse the repository at this point in the history
Set the RTAX_LOCKED metric to INETPEER_METRICS_NEW (basically,
all ones) on fresh inetpeer entries.

This way code can determine if default metrics have been loaded
in from a routing table entry already.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jan 27, 2011
1 parent 6065982 commit 144001b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/net/inetpeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ struct inet_peer {

void inet_initpeers(void) __init;

#define INETPEER_METRICS_NEW (~(u32) 0)

static inline bool inet_metrics_new(const struct inet_peer *p)
{
return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW;
}

/* can be called with or without local BH being disabled */
struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create);

Expand Down
1 change: 1 addition & 0 deletions net/ipv4/inetpeer.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create)
atomic_set(&p->rid, 0);
atomic_set(&p->ip_id_count, secure_ip_id(daddr->a4));
p->tcp_ts_stamp = 0;
p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
INIT_LIST_HEAD(&p->unused);


Expand Down

0 comments on commit 144001b

Please sign in to comment.