Skip to content

Commit fb984d1

Browse files
committed
Merge branch 'doc-netlink-specs-add-vlan-support'
Hangbin Liu says: ==================== doc/netlink/specs: Add vlan support Add vlan support in rt_link spec. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 51cf49f + 782c108 commit fb984d1

File tree

2 files changed

+82
-3
lines changed

2 files changed

+82
-3
lines changed

Documentation/netlink/specs/rt_link.yaml

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ definitions:
5050
name: dormant
5151
-
5252
name: echo
53-
53+
-
54+
name: vlan-protocols
55+
type: enum
56+
entries:
57+
-
58+
name: 8021q
59+
value: 33024
60+
-
61+
name: 8021ad
62+
value: 34984
5463
-
5564
name: rtgenmsg
5665
type: struct
@@ -729,7 +738,38 @@ definitions:
729738
-
730739
name: filter-mask
731740
type: u32
732-
741+
-
742+
name: ifla-vlan-flags
743+
type: struct
744+
members:
745+
-
746+
name: flags
747+
type: u32
748+
enum: vlan-flags
749+
enum-as-flags: true
750+
-
751+
name: mask
752+
type: u32
753+
display-hint: hex
754+
-
755+
name: vlan-flags
756+
type: flags
757+
entries:
758+
- reorder-hdr
759+
- gvrp
760+
- loose-binding
761+
- mvrp
762+
- bridge-binding
763+
-
764+
name: ifla-vlan-qos-mapping
765+
type: struct
766+
members:
767+
-
768+
name: from
769+
type: u32
770+
-
771+
name: to
772+
type: u32
733773

734774
attribute-sets:
735775
-
@@ -1507,6 +1547,39 @@ attribute-sets:
15071547
-
15081548
name: num-disabled-queues
15091549
type: u32
1550+
-
1551+
name: linkinfo-vlan-attrs
1552+
name-prefix: ifla-vlan-
1553+
attributes:
1554+
-
1555+
name: id
1556+
type: u16
1557+
-
1558+
name: flag
1559+
type: binary
1560+
struct: ifla-vlan-flags
1561+
-
1562+
name: egress-qos
1563+
type: nest
1564+
nested-attributes: ifla-vlan-qos
1565+
-
1566+
name: ingress-qos
1567+
type: nest
1568+
nested-attributes: ifla-vlan-qos
1569+
-
1570+
name: protocol
1571+
type: u16
1572+
enum: vlan-protocols
1573+
byte-order: big-endian
1574+
-
1575+
name: ifla-vlan-qos
1576+
name-prefix: ifla-vlan-qos
1577+
attributes:
1578+
-
1579+
name: mapping
1580+
type: binary
1581+
multi-attr: true
1582+
struct: ifla-vlan-qos-mapping
15101583
-
15111584
name: linkinfo-vrf-attrs
15121585
name-prefix: ifla-vrf-
@@ -1666,6 +1739,9 @@ sub-messages:
16661739
-
16671740
value: tun
16681741
attribute-set: linkinfo-tun-attrs
1742+
-
1743+
value: vlan
1744+
attribute-set: linkinfo-vlan-attrs
16691745
-
16701746
value: vrf
16711747
attribute-set: linkinfo-vrf-attrs

tools/net/ynl/lib/ynl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,10 @@ def _formatted_string(self, raw, display_hint):
819819
if display_hint == 'mac':
820820
formatted = ':'.join('%02x' % b for b in raw)
821821
elif display_hint == 'hex':
822-
formatted = bytes.hex(raw, ' ')
822+
if isinstance(raw, int):
823+
formatted = hex(raw)
824+
else:
825+
formatted = bytes.hex(raw, ' ')
823826
elif display_hint in [ 'ipv4', 'ipv6' ]:
824827
formatted = format(ipaddress.ip_address(raw))
825828
elif display_hint == 'uuid':

0 commit comments

Comments
 (0)