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

Script do not work in docker environment #7

Open
extremelyonline opened this issue Nov 19, 2023 · 4 comments
Open

Script do not work in docker environment #7

extremelyonline opened this issue Nov 19, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@extremelyonline
Copy link

Hi, I am using the docker image and ran docker run --rm --privileged --name smart-ipv6-rotator --network host quay.io/invidious/smart-ipv6-rotator:latest run --ipv6range=<IPV6RANGE>/64. It ran successfully the first time, but showed the following error subsequently. Is this error related to my network or to the docker image? Thank you.

[DEBUG] Debug info:
random_ipv6_address --> <Redacted>
random_ipv6_address_mask --> 64
gateway --> <Redacted>
interface_index --> 2
interface_name --> <Redacted>
ipv6_subnet --> <Redacted>
    ret = self.nlm_request(
          ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyroute2/netlink/nlsocket.py", line 870, in nlm_request
    return tuple(self._genlm_request(*argv, **kwarg))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyroute2/netlink/nlsocket.py", line 1214, in nlm_request
    for msg in self.get(
               ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyroute2/netlink/nlsocket.py", line 873, in get
    return tuple(self._genlm_get(*argv, **kwarg))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyroute2/netlink/nlsocket.py", line 550, in get
    raise msg['header']['error']
pyroute2.netlink.exceptions.NetlinkError: (17, 'File exists')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/smart-ipv6-rotator.py", line 310, in <module>
    SmartIPv6Rotator()
  File "/app/smart-ipv6-rotator.py", line 53, in __init__
    getattr(self, args.command)()
  File "/app/smart-ipv6-rotator.py", line 239, in run
    self.clean_previous_setup(memory_settings)
TypeError: SmartIPv6Rotator.clean_previous_setup() missing 1 required positional argument: 'args'

@unixfox
Copy link
Member

unixfox commented Nov 19, 2023

The script stores a small database to remember what previous subnet it used: https://github.com/iv-org/smart-ipv6-rotator/blob/master/smart-ipv6-rotator.py#L64
In order to remove it for the next run.

Could you try this command instead:

docker run --rm --privileged -v /tmp/smart-ipv6-rotator.py:/tmp/smart-ipv6-rotator.py --name smart-ipv6-rotator --network host quay.io/invidious/smart-ipv6-rotator:latest run --ipv6range=<IPV6RANGE>/64

Before that you will need to cleanup the ipv6 subnets that were setup by the script or just reboot the machine.

@extremelyonline
Copy link
Author

Thanks. Unfortunately, that was not the problem. The error persisted after I both cleaned up the ipv6 subnets and reboot the machine.

Running the py in bare metal works. The issue is docker-specific.

@unixfox unixfox changed the title clean_previous_setup() missing 1 required positional argument: 'args Script do not work in docker environment Nov 27, 2023
@CDaut
Copy link

CDaut commented Dec 19, 2023

The script works for me in docker using the command docker run --rm --privileged --name smart-ipv6-rotator --network host quay.io/invidious/smart-ipv6-rotator:latest run --ipv6range=<IPv6Range>::/64
This is the output:

[INFO] You have IPv6 connectivity. Continuing.
[INFO] No cleanup of previous setup needed.
[DEBUG] Debug info:
random_ipv6_address --> <correct random IP in my IP range>
random_ipv6_address_mask --> 64
gateway --> fe80::1
interface_index --> 2
interface_name --> eth0
ipv6_subnet --> <same as in command>
[INFO] Correctly using the new random IPv6 address, continuing.
[INFO] Correctly configured the IPv6 routes for Google IPv6 ranges.

@unixfox unixfox added the enhancement New feature or request label May 22, 2024
@unixfox
Copy link
Member

unixfox commented May 22, 2024

@CDaut you need to store the database somewhere, this won't really work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants