Skip to content

Is it possible to disable IPv6 (or IPv4)? #2476

Answered by juha-h
juha-h asked this question in Q&A
Discussion options

You must be logged in to vote

Like this:

diff --git a/src/config.c b/src/config.c
index 7948215b..d25e70b8 100644
--- a/src/config.c
+++ b/src/config.c
@@ -458,6 +458,15 @@ int config_parse_conf(struct config *cfg, const struct conf *conf)
                &cfg->net.use_getaddrinfo);
    (void)conf_get_str(conf, "net_interface",
               cfg->net.ifname, sizeof(cfg->net.ifname));
+   if (0 == conf_get(conf, "net_af", &pl)) {
+       if (0 == pl_strcasecmp(&pl, "4"))
+           cfg->net.af = AF_INET;
+       else if (0 == pl_strcasecmp(&pl, "6"))
+           cfg->net.af = AF_INET6;
+       else {
+           warning("unsupported af (%r)\n", &pl);
+       }
+   }
 
    return err;
 }
@@ -537,6 +546,7 @@ int config…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

juha-h
Mar 11, 2023
Maintainer Author

You must be logged in to vote
0 replies
Comment options

juha-h
Mar 11, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by juha-h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants