Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 144001bd authored by David S. Miller's avatar David S. Miller
Browse files

inetpeer: Mark metrics as "new" in fresh inetpeer entries.



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: default avatarDavid S. Miller <davem@davemloft.net>
parent 60659823
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);

+1 −0
Original line number Diff line number Diff line
@@ -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);