* [PATCH 2/3] inetpeer: Mark metrics as "new" in fresh inetpeer entries.
@ 2011-01-27 23:01 David Miller
0 siblings, 0 replies; only message in thread
From: David Miller @ 2011-01-27 23:01 UTC (permalink / raw)
To: netdev
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>
---
include/net/inetpeer.h | 7 +++++++
net/ipv4/inetpeer.c | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 2af0c63..61f2c66 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -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);
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index a96e656..b6513b1 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -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);
--
1.7.3.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-27 23:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 23:01 [PATCH 2/3] inetpeer: Mark metrics as "new" in fresh inetpeer entries David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).