Skip to content

Commit 2bc8ca4

Browse files
klassertdavem330
authored andcommitted
ipv4: Fix inetpeer expire time information
As we update the learned pmtu informations on demand, we might report a nagative expiration time value to userspace if the pmtu informations are already expired and we have not send a packet to that inetpeer after expiration. With this patch we send a expire time of null to userspace after expiration until the next packet is send to that inetpeer. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 20db93c commit 2bc8ca4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/ipv4/route.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ static int rt_fill_info(struct net *net,
28452845
struct rtable *rt = skb_rtable(skb);
28462846
struct rtmsg *r;
28472847
struct nlmsghdr *nlh;
2848-
long expires = 0;
2848+
unsigned long expires = 0;
28492849
const struct inet_peer *peer = rt->peer;
28502850
u32 id = 0, ts = 0, tsage = 0, error;
28512851

@@ -2902,8 +2902,12 @@ static int rt_fill_info(struct net *net,
29022902
tsage = get_seconds() - peer->tcp_ts_stamp;
29032903
}
29042904
expires = ACCESS_ONCE(peer->pmtu_expires);
2905-
if (expires)
2906-
expires -= jiffies;
2905+
if (expires) {
2906+
if (time_before(jiffies, expires))
2907+
expires -= jiffies;
2908+
else
2909+
expires = 0;
2910+
}
29072911
}
29082912

29092913
if (rt_is_input_route(rt)) {

0 commit comments

Comments
 (0)