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

Connection via IPv6 using IP-Address fails #17

Open
flycam opened this issue Apr 8, 2022 · 2 comments
Open

Connection via IPv6 using IP-Address fails #17

flycam opened this issue Apr 8, 2022 · 2 comments

Comments

@flycam
Copy link

flycam commented Apr 8, 2022

Trying to connect to a device using and IPv6 Address fails with the error: raise LoginError("Cookies were not set correctly. Login failed")
I did encase the IP Address in square brackets like [2001:db8:1::25], as it is customary for URLs. Without the brackets, I got even more parsing errors.

In the file session.py:159 in method open(...): )

        self.connected = (
            hasattr(cookies, "_cookies") and self.ip in cookies._cookies
        )

the check for connected fails, as for some reason unknown to me the switch returns the cookie with the address [2001:db8:1::25].local. This extra .local at the end of the ip fails the test condition.

I tried to mitigate by also checking for .local, and that is a workaround for my development machine at the moment.

        self.connected = hasattr(cookies, '_cookies') and (self.ip in cookies._cookies or "%s.local"% self.ip in cookies._cookies)

I would really appreciate a fix for this in the official pypi version (or in aos-cx, whatever is preferred), as plan to run this on ipv6-only networks, and newly deployed switches do not have dns entries yet.
If I need to push this via my SE or a support case, please tell me as that would be possible.

@tchiapuziowong
Copy link
Member

Looking into this and how it escaped testing! Thank you for bringing this to our attention 👍

@liske
Copy link

liske commented Aug 4, 2024

This cookie check in pyaoscx looks almost broken.

I have a setup were an alternative https port is used, this breaks this module. I wonder

  • Why is the cookie checked at all?
  • Why is a private variable of requests's CookieJar class accessed from pyaoscx?

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

No branches or pull requests

3 participants