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

Add IPV6 support #1065

Closed
aryanA101a opened this issue Feb 27, 2024 · 2 comments · Fixed by #1074
Closed

Add IPV6 support #1065

aryanA101a opened this issue Feb 27, 2024 · 2 comments · Fixed by #1074
Assignees
Milestone

Comments

@aryanA101a
Copy link
Contributor

Originally posted by @aryanA101a in kiwix/kiwix-tools#545 (comment)

@aryanA101a
Copy link
Contributor Author

aryanA101a commented Mar 11, 2024

I have made some progress in adding ipv6 support to libkiwix.

I have some findings to share:

Suppose my computer's wireless interface has this address config

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.32.100  netmask 255.255.255.0  broadcast 192.168.32.255
        inet6 fe80::682:41cd:4e8e:25a7  prefixlen 64  scopeid 0x20<link>
        ether 30:d1:6b:f5:7a:31  txqueuelen 1000  (Ethernet)
        RX packets 51417098  bytes 57088680516 (53.1 GiB)
        RX errors 0  dropped 117  overruns 0  frame 0
        TX packets 14994882  bytes 2248629898 (2.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and I run
kiwix-serve viki.zim -6 -p 2000 (-6 for ipv6)
since I have not given any explicit ipv6 addr, it'll serve at ::0 (all the ipv6 interfaces)
but for the end user we are showing them a genuine ip address
The Kiwix server is running and can be accessed in the local network at: http://[fe80::682:41cd:4e8e:25a7]:2000

according to this

ip_addr kiwix::getBestPublicIp() {
  std::map<std::string,ip_addr>  interfaces = getNetworkInterfaces();

#ifndef _WIN32
  const char* const prioritizedNames[] =
      { "eth0", "eth1", "wlan0", "wlan1", "en0", "en1" };

Everything is as intended as of now.
But, the thing is the ip address it is serving on is of link local ipv6 type.
And this type of address has its own type of shenanigans to work with.

curl http://[fe80::682:41cd:4e8e:25a7]:2000
curl: (7) Couldn't connect to server

Adding %interface_name to the address makes it work
curl http://[fe80::682:41cd:4e8e:25a7%eth0]:2000

And as per my findings, I could not find a way to access this linklocal address in the browser.

There's also a global ipv6 address it works as intended, but to test it I had to manually assign a global ipv6 address to my interface and by default it was not configured for my system.

@mgautierfr can you check if your interface is configured for a global ipv6 address

@mgautierfr
Copy link
Member

My ipv6 address is a local link too.
Maybe (I'm not sure) interfaces get a public ipv6 only if we are in a ipv6 network ? I have great doubts that my current network is ipv6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants