Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inet] Append correct attribute type for RTA_DST. Fixes JB#60963 #56

Merged
merged 1 commit into from Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions connman/src/inet.c
Expand Up @@ -2911,11 +2911,21 @@ int __connman_inet_get_route(const char *dest_address,
rth->req.u.r.rt.rtm_scope = 0;
rth->req.u.r.rt.rtm_type = 0;
rth->req.u.r.rt.rtm_src_len = 0;
rth->req.u.r.rt.rtm_dst_len = rp->ai_addrlen << 3;
rth->req.u.r.rt.rtm_tos = 0;

__connman_inet_rtnl_addattr_l(&rth->req.n, sizeof(rth->req), RTA_DST,
&rp->ai_addr, rp->ai_addrlen);
if (rp->ai_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *)rp->ai_addr;

rth->req.u.r.rt.rtm_dst_len = 32;
__connman_inet_rtnl_addattr_l(&rth->req.n, sizeof(rth->req),
RTA_DST, &sin->sin_addr, sizeof(sin->sin_addr));
} else if (rp->ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rp->ai_addr;

rth->req.u.r.rt.rtm_dst_len = 128;
__connman_inet_rtnl_addattr_l(&rth->req.n, sizeof(rth->req),
RTA_DST, &sin6->sin6_addr, sizeof(sin6->sin6_addr));
}

freeaddrinfo(rp);

Expand Down