lwIP 2.1.1 Lightweight IP stack

Modules | Functions
IPv6
APIs » "raw" APIs » IP

## Modules
| DHCPv6
| MLD6
| IPv6 Zones

## Functions
const ip_addr_t * | ip6_select_source_address (struct netif *netif, const ip6_addr_t *dest)

## Detailed Description

## Function Documentation

## ◆ ip6_select_source_address()

const ip_addr_t* ip6_select_source_address | ( | struct netif * | netif,
|  | const ip6_addr_t * | dest
| ) |  |

Select the best IPv6 source address for a given destination IPv6 address.

This implementation follows RFC 6724 Sec. 5 to the following extent:

- Rules 1, 2, 3: fully implemented
- Rules 4, 5, 5.5: not applicable
- Rule 6: not implemented
- Rule 7: not applicable
- Rule 8: limited to "prefer /64 subnet match over non-match"

For Rule 2, we deliberately deviate from RFC 6724 Sec. 3.1 by considering ULAs to be of smaller scope than global addresses, to avoid that a preferred ULA is picked over a deprecated global address when given a global address as destination, as that would likely result in broken two-way communication.

As long as temporary addresses are not supported (as used in Rule 7), a proper implementation of Rule 8 would obviate the need to implement Rule 6.

Parameters

  netif | the netif on which to send a packet
  dest | the destination we are trying to reach (possibly not properly zoned)

Returns
  the most suitable source address to use, or NULL if no suitable source address is found