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

misc: remove HAVE_INET6 #1159

Merged
merged 13 commits into from
Jul 23, 2024
1 change: 0 additions & 1 deletion cmake/re-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ endif()

list(APPEND RE_DEFINITIONS
HAVE_ATOMIC
HAVE_INET6
HAVE_SELECT
)

Expand Down
5 changes: 1 addition & 4 deletions src/dns/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,7 @@ int dnsc_alloc(struct dnsc **dcpp, const struct dnsc_conf *conf,
{
struct dnsc *dnsc;
struct sa laddr;
#ifdef HAVE_INET6
struct sa laddr6;
#endif
int err;

if (!dcpp)
Expand All @@ -1241,10 +1239,9 @@ int dnsc_alloc(struct dnsc **dcpp, const struct dnsc_conf *conf,
sa_set_str(&laddr, "0.0.0.0", 0);
err = udp_listen(&dnsc->us, &laddr, udp_recv_handler, dnsc);

#ifdef HAVE_INET6
sa_set_str(&laddr6, "::", 0);
err &= udp_listen(&dnsc->us6, &laddr6, udp_recv_handler, dnsc);
#endif

if (err)
goto out;

Expand Down
4 changes: 0 additions & 4 deletions src/fmt/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,20 +441,16 @@ static int vhprintf(const char *fmt, va_list ap, re_vprintf_h *vph, void *arg,
break;
}

#ifdef HAVE_INET6
if (AF_INET6 == sa_af(sa)) {
ch = '[';
err |= vph(&ch, 1, arg);
}
#endif
err |= write_padded(addr, strlen(addr), pad, ' ',
plr, NULL, vph, arg);
#ifdef HAVE_INET6
if (AF_INET6 == sa_af(sa)) {
ch = ']';
err |= vph(&ch, 1, arg);
}
#endif

ch = ':';
err |= vph(&ch, 1, arg);
Expand Down
13 changes: 0 additions & 13 deletions src/http/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ struct http_cli {
struct mbuf *cert;
struct mbuf *key;
struct sa laddr;
#ifdef HAVE_INET6
struct sa laddr6;
#endif
size_t bufsize_max;
};

Expand Down Expand Up @@ -601,10 +599,8 @@ static int conn_connect(struct http_req *req)

if (sa_af(&conn->addr) == AF_INET)
laddr = &req->cli->laddr;
#ifdef HAVE_INET6
else if (sa_af(&conn->addr) == AF_INET6)
laddr = &req->cli->laddr6;
#endif

if (sa_isset(laddr, SA_ADDR)) {
sa_set_scopeid(&conn->addr, sa_scopeid(laddr));
Expand Down Expand Up @@ -878,16 +874,13 @@ int http_request(struct http_req **reqp, struct http_cli *cli, const char *met,
goto out;
}
else {
#ifdef HAVE_INET6
struct sa tmp;
#endif
err = dnsc_query(&req->dq, cli->dnsc, req->host,
DNS_TYPE_A, DNS_CLASS_IN, true,
query_handler, req);
if (err)
goto out;

#ifdef HAVE_INET6
if (0 == net_default_source_addr_get(AF_INET6, &tmp)) {

err = dnsc_query(&req->dq6, cli->dnsc, req->host,
Expand All @@ -896,7 +889,6 @@ int http_request(struct http_req **reqp, struct http_cli *cli, const char *met,
if (err)
goto out;
}
#endif
}

out:
Expand Down Expand Up @@ -1338,13 +1330,8 @@ void http_client_set_laddr(struct http_cli *cli, const struct sa *addr)
*/
void http_client_set_laddr6(struct http_cli *cli, const struct sa *addr)
{
#ifdef HAVE_INET6
if (cli && addr)
sa_cpy(&cli->laddr6, addr);
#else
(void)cli;
(void)addr;
#endif
}


Expand Down
6 changes: 0 additions & 6 deletions src/net/linux/rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt)
= *(uint32_t *)RTA_DATA(rtattr);
break;

#ifdef HAVE_INET6
case AF_INET6:
sa_set_in6(&rt->gw, RTA_DATA(rtattr), 0);
break;
#endif

default:
DEBUG_WARNING("RTA_GW: unknown family %d\n",
Expand All @@ -146,11 +144,9 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt)
= *(uint32_t *)RTA_DATA(rtattr);
break;

#ifdef HAVE_INET6
case AF_INET6:
sa_set_in6(&rt->dst, RTA_DATA(rtattr), 0);
break;
#endif

default:
DEBUG_WARNING("RTA_DST: unknown family %d\n",
Expand Down Expand Up @@ -227,11 +223,9 @@ int net_rt_list(net_rt_h *rth, void *arg)
if (0 != rt_parse(nlmsg, &rt))
continue;

#ifdef HAVE_INET6
if (AF_INET6 == sa_af(&rt.dst)
&& IN6_IS_ADDR_UNSPECIFIED(&rt.dst.u.in6.sin6_addr))
continue;
#endif

if (rth(rt.ifname, &rt.dst, rt.dstlen, &rt.gw, arg))
break;
Expand Down
2 changes: 0 additions & 2 deletions src/net/netstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ const char *net_af2name(int af)

case AF_UNSPEC: return "AF_UNSPEC";
case AF_INET: return "AF_INET";
#ifdef HAVE_INET6
case AF_INET6: return "AF_INET6";
#endif
default: return "???";
}
}
4 changes: 0 additions & 4 deletions src/net/rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ static bool rt_debug_handler(const char *ifname, const struct sa *dst,
err |= re_hprintf(pf, "%-40j", gw);
err |= re_hprintf(pf, " %-15s ", ifname);

#ifdef HAVE_INET6
if (AF_INET6 == sa_af(dst)) {
const struct sockaddr_in6 *sin6 = &dst->u.in6;
const struct in6_addr *in6 = &sin6->sin6_addr;
Expand All @@ -43,7 +42,6 @@ static bool rt_debug_handler(const char *ifname, const struct sa *dst,
if (IN6_IS_ADDR_SITELOCAL(in6))
err |= re_hprintf(pf, " SITELOCAL");
}
#endif

err |= re_hprintf(pf, "\n");

Expand Down Expand Up @@ -98,7 +96,6 @@ static bool rt_default_get_handler(const char *_ifname, const struct sa *dst,
}
break;

#ifdef HAVE_INET6
case AF_INET6:
if (IN6_IS_ADDR_MULTICAST(&dst->u.in6.sin6_addr))
return false;
Expand All @@ -111,7 +108,6 @@ static bool rt_default_get_handler(const char *_ifname, const struct sa *dst,
return false;
}
break;
#endif
}

return false;
Expand Down
2 changes: 0 additions & 2 deletions src/pcp/payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ static int pcp_write_port(struct mbuf *mb, const struct sa *sa)
port_be = sa->u.in.sin_port;
break;

#ifdef HAVE_INET6
case AF_INET6:
port_be = sa->u.in6.sin6_port;
break;
#endif

default:
return EAFNOSUPPORT;
Expand Down
4 changes: 0 additions & 4 deletions src/pcp/pcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ int pcp_ipaddr_encode(struct mbuf *mb, const struct sa *sa)
4);
break;

#ifdef HAVE_INET6
case AF_INET6:
err |= mbuf_write_mem(mb, sa->u.in6.sin6_addr.s6_addr, 16);
break;
#endif

default:
err = EAFNOSUPPORT;
Expand Down Expand Up @@ -62,12 +60,10 @@ int pcp_ipaddr_decode(struct mbuf *mb, struct sa *sa)
sa_init(sa, AF_INET);
memcpy(&sa->u.in.sin_addr, p + 12, 4);
}
#ifdef HAVE_INET6
else {
sa_init(sa, AF_INET6);
memcpy(sa->u.in6.sin6_addr.s6_addr, p, 16);
}
#endif

mb->pos += 16;

Expand Down
4 changes: 0 additions & 4 deletions src/rtmp/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,7 @@ int rtmp_connect(struct rtmp_conn **connp, struct dnsc *dnsc, const char *uri,
goto out;
}
else {
#ifdef HAVE_INET6
struct sa tmp;
#endif

if (!dnsc) {
err = EINVAL;
Expand All @@ -885,7 +883,6 @@ int rtmp_connect(struct rtmp_conn **connp, struct dnsc *dnsc, const char *uri,
if (err)
goto out;

#ifdef HAVE_INET6
if (0 == net_default_source_addr_get(AF_INET6, &tmp)) {

err = dnsc_query(&conn->dnsq6, dnsc, conn->host,
Expand All @@ -894,7 +891,6 @@ int rtmp_connect(struct rtmp_conn **connp, struct dnsc *dnsc, const char *uri,
if (err)
goto out;
}
#endif
}

out:
Expand Down
2 changes: 0 additions & 2 deletions src/sa/printaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ int sa_print_addr(struct re_printf *pf, const struct sa *sa)

err = re_hprintf(pf, "%j", sa);

#ifdef HAVE_INET6
if (sa_af(sa) == AF_INET6 && sa_is_linklocal(sa)) {
#ifdef HAVE_GETIFADDRS
char ifname[IF_NAMESIZE];
Expand All @@ -44,7 +43,6 @@ int sa_print_addr(struct re_printf *pf, const struct sa *sa)
err |= re_hprintf(pf, "%%%d", scope_id);
#endif
}
#endif

return err;
}
Loading
Loading