netlink: specs: support ipv4-or-v6 for dual-stack fields

Since commit 1b255e1bea ("tools: ynl: add ipv4-or-v6 display hint"), we
can display either IPv4 or IPv6 addresses for a single field based on the
address family. However, most dual-stack fields still use the ipv4 display
hint. This update changes them to use the new ipv4-or-v6 display hint and
converts IPv4-only fields to use the u32 type.

Field changes:
  - v4-or-v6
    - IFA_ADDRESS, IFA_LOCAL
    - IFLA_GRE_LOCAL, IFLA_GRE_REMOTE
    - IFLA_VTI_LOCAL, IFLA_VTI_REMOTE
    - IFLA_IPTUN_LOCAL, IFLA_IPTUN_REMOTE
    - NDA_DST
    - RTA_DST, RTA_SRC, RTA_GATEWAY, RTA_PREFSRC
    - FRA_SRC, FRA_DST
  - ipv4
    - IFA_BROADCAST
    - IFLA_GENEVE_REMOTE
    - IFLA_IPTUN_6RD_RELAY_PREFIX

Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20251117024457.3034-3-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Hangbin Liu 2025-11-17 02:44:56 +00:00 committed by Jakub Kicinski
parent 4abe51dba6
commit 1064d521d1
8 changed files with 23 additions and 21 deletions

View File

@ -227,7 +227,7 @@ properties:
Optional format indicator that is intended only for choosing Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this the right formatting mechanism when displaying values of this
type. type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] enum: [ hex, mac, fddi, ipv4, ipv6, ipv4-or-v6, uuid ]
# Start genetlink-c # Start genetlink-c
name-prefix: name-prefix:
type: string type: string

View File

@ -185,7 +185,7 @@ properties:
Optional format indicator that is intended only for choosing Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this the right formatting mechanism when displaying values of this
type. type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] enum: [ hex, mac, fddi, ipv4, ipv6, ipv4-or-v6, uuid ]
# Make sure name-prefix does not appear in subsets (subsets inherit naming) # Make sure name-prefix does not appear in subsets (subsets inherit naming)
dependencies: dependencies:

View File

@ -157,7 +157,7 @@ properties:
Optional format indicator that is intended only for choosing Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this the right formatting mechanism when displaying values of this
type. type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ] enum: [ hex, mac, fddi, ipv4, ipv6, ipv4-or-v6, uuid ]
struct: struct:
description: Name of the nested struct type. description: Name of the nested struct type.
type: string type: string

View File

@ -86,17 +86,17 @@ attribute-sets:
- -
name: address name: address
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: local name: local
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: label name: label
type: string type: string
- -
name: broadcast name: broadcast
type: binary type: u32
display-hint: ipv4 display-hint: ipv4
- -
name: anycast name: anycast

View File

@ -1707,11 +1707,11 @@ attribute-sets:
- -
name: local name: local
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: remote name: remote
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: ttl name: ttl
type: u8 type: u8
@ -1833,11 +1833,11 @@ attribute-sets:
- -
name: local name: local
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: remote name: remote
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: fwmark name: fwmark
type: u32 type: u32
@ -1868,7 +1868,7 @@ attribute-sets:
type: u32 type: u32
- -
name: remote name: remote
type: binary type: u32
display-hint: ipv4 display-hint: ipv4
- -
name: ttl name: ttl
@ -1952,11 +1952,11 @@ attribute-sets:
- -
name: local name: local
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: remote name: remote
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: ttl name: ttl
type: u8 type: u8
@ -1986,7 +1986,7 @@ attribute-sets:
display-hint: ipv6 display-hint: ipv6
- -
name: 6rd-relay-prefix name: 6rd-relay-prefix
type: binary type: u32
display-hint: ipv4 display-hint: ipv4
- -
name: 6rd-prefixlen name: 6rd-prefixlen

View File

@ -194,7 +194,7 @@ attribute-sets:
- -
name: dst name: dst
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: lladdr name: lladdr
type: binary type: binary

View File

@ -87,11 +87,11 @@ attribute-sets:
- -
name: dst name: dst
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: src name: src
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: iif name: iif
type: u32 type: u32
@ -101,14 +101,14 @@ attribute-sets:
- -
name: gateway name: gateway
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: priority name: priority
type: u32 type: u32
- -
name: prefsrc name: prefsrc
type: binary type: binary
display-hint: ipv4 display-hint: ipv4-or-v6
- -
name: metrics name: metrics
type: nest type: nest

View File

@ -96,10 +96,12 @@ attribute-sets:
attributes: attributes:
- -
name: dst name: dst
type: u32 type: binary
display-hint: ipv4-or-v6
- -
name: src name: src
type: u32 type: binary
display-hint: ipv4-or-v6
- -
name: iifname name: iifname
type: string type: string