8000 lwip: Support `family` specification in getaddrinfo. by greezybacon · Pull Request #17446 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

lwip: Support family specification in getaddrinfo. #17446

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

greezybacon
Copy link
Contributor

Summary

socket.getaddrinfo() supports the specification of an address family; however, the LwIP implementation does not use it. This change allows the application to specify the address family request in DNS resolution. If no family is specified, it falls back to the default preference configured with network.ipconfig().

Testing

I've done some minimal testing on this using an RP2040 and a Wiznet W5100S. It works as expected and returns the address of the family requested. For example:

>>> import socket
>>> socket.getaddrinfo('www.google.com', 80)
[(2, 1, 0, '', ('216.239.38.120', 80))]
>>> socket.getaddrinfo('www.google.com', 80, socket.AF_INET6)
[(2, 1, 0, '', ('2001:4860:4802:32::78', 80))]
>>> socket.getaddrinfo('www.google.com', 80, socket.AF_INET)
[(2, 1, 0, '', ('216.239.38.120', 80))]

socket.getaddrinfo() supports the specification of an address family;
however, the LwIP implementation does not use it. This change allows the
application to specify the address family request in DNS resolution. If
no family is specified, it falls back to the default preference
configured with network.ipconfig().

Signed-Off-By: Jared Hancock <jared.hancock@centeredsolutions.com>
Copy link
codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base (52ca826) to head (a9f009b).
Report is 227 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #17446      +/-   ##
==========================================
- Coverage   98.54%   98.54%   -0.01%     
==========================================
  Files         169      169              
  Lines       21889    21943      +54     
==========================================
+ Hits        21570    21623      +53     
- Misses        319      320       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
github-actions bot commented Jun 6, 2025

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:   +16 +0.002% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0