Skip to content

IPv6 APIs #12600

@darconeous

Description

@darconeous

There are already various bugs tracking adding IPv6 to the various ports:

But, even with these changes, there are some critical missing parts: the APIs. For example, <netif>.ifconfig() returns a tuple of the IPv4 address configuration. However, there is no API to get the IPv6 addresses of the device, and it looks like such a thing isn't even defined yet.

So I wanted to open this issue to discuss potential API additions to help make IPv6 a first-class citizen in micropython.

Specifically, we need the ability to:

  1. List the current IPv6 addresses assigned to an interface, along with the status of each address
  2. Statically configure IPv6 addresses, along with adding the associated on-link routes
  3. Turn on/off SLAAC (if support is compiled in)
  4. Turn on/off DHCPv6 (if support is compiled in)
  5. Set a preference for IPv6 vs IPv4 when performing name lookups that have both A and AAAA records.

We currently don't have any way to do any of this from Micropython, so I think we should at least start to define what this should look like.

For compatibility reasons, I think we should avoid extending the ifconfig() method. Lots of code seems pretty dependent on how this method works. I was thinking something like this as a starting point:

  • <netif>.MAX_IPV6_ADDRS - constant describing the maximum number of IPv6 addresses that can be assigned to this interface. (Compile-time default seems to be 3)
  • <netif>.v6_addrs() - Returns a list of tuples, one tuple per address. Each tuple would have the following fields:
    1. IPv6 Address (as a string?)
    2. Flags (Temporary, Deprecated, SLAAC, DHCPv6, Static, on-link, etc)
    3. remaining preferred lifetime (or None)
    4. remaining valid lifetime (or None)
  • <netif>.v6_del_addr(<addr>) - Removes the given IPv6 address.
  • <netif>.v6_add_addr(<addr>, <prefix-len>) - Adds the given IPv6 address, optionally adding a route for other on-link devices with the same prefix.
  • <netif>.config('host-lookup-pref', <'v6'|'v4'>) - Configures the host lookup preference when there are both A and AAAA records.
  • <netif>.config('slaac_en', <True|False>) - Turns on or off SLAAC.
  • <netif>.config('dhcpv6_en', <True|False>) - Turns on or off DHCPv6.

I'm sure this could be improved upon, but wanted to go ahead and put this out there as a starting point.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature requests, new feature implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy