Skip to content

Commit

Permalink
linux: ignore source-based routes
Browse files Browse the repository at this point in the history
Since source-based routes aren't used by dhcpcd, it's best if they
are ignored so that they aren't confused with default routes.
  • Loading branch information
sshambar committed Sep 26, 2024
1 parent 0051112 commit 2dc202d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/if-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,20 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, struct nlmsghdr *nlm)
case RTA_DST:
sa = &rt->rt_dest;
break;
case RTA_SRC:
{
struct sockaddr ssa;
socklen_t salen;

ssa.sa_family = rtm->rtm_family;
salen = sa_addrlen(&ssa);
memcpy((char *)&ssa + sa_addroffset(&ssa),
RTA_DATA(rta), MIN(salen, RTA_PAYLOAD(rta)));
/* if source-route, ignore it */
if(! sa_is_unspecified(&ssa))
return -1;
}
break;
case RTA_GATEWAY:
sa = &rt->rt_gateway;
break;
Expand Down

0 comments on commit 2dc202d

Please sign in to comment.