Skip to content

Commit

Permalink
Only send non-zero route lifetime to NETLINK
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinMcInnes authored Jan 9, 2025
1 parent 4a07e73 commit fb70fe8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/if-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,7 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, struct nlmsghdr *nlm)
}
case RTA_EXPIRES:
{
if (rt->rt_expires != 0)
{
rt->rt_expires = *(uint32_t *)RTA_DATA(rta);
}
rt->rt_expires = *(uint32_t *)RTA_DATA(rta);
break;
}
}
Expand Down Expand Up @@ -1744,7 +1741,8 @@ if_route(unsigned char cmd, const struct rt *rt)
add_attr_32(&nlm.hdr, sizeof(nlm), RTA_OIF, rt->rt_ifp->index);

/* add route lifetime */
add_attr_32(&nlm.hdr, sizeof(nlm), RTA_EXPIRES, rt->rt_expires);
if (rt->rt_expires != 0)
add_attr_32(&nlm.hdr, sizeof(nlm), RTA_EXPIRES, rt->rt_expires);

if (rt->rt_metric != 0)
add_attr_32(&nlm.hdr, sizeof(nlm), RTA_PRIORITY,
Expand Down

0 comments on commit fb70fe8

Please sign in to comment.