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

Comparing IP addresses and MAC addresses results in stack overflow #127

Open
BlackVegetable opened this issue Oct 1, 2014 · 1 comment

Comments

@BlackVegetable
Copy link

If a program attempts to compare an IP address with an Ethernet (MAC) address (such as using "is"), rather than resulting in an appropriate error stating invalid types were used for comparison, some mutual recursion results which only terminates on a stack overflow and a program crash.

@ljluestc
Copy link


import ipaddress
import netifaces

# Example IP and MAC addresses
ip_address = ipaddress.ip_address('192.168.1.1')
mac_address = netifaces.ifaddresses('eth0')[netifaces.AF_LINK][0]['addr']

# Comparing IP and MAC addresses
if ip_address == mac_address:
    print("IP and MAC addresses are equal.")
else:
    print("IP and MAC addresses are not equal.")

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

2 participants