constants: Add provenance information and update.

Julien LepillerSun Mar 23 19:06:27+0100 2025

7be7c5f

constants: Add provenance information and update. * netlink/constant.scm: Add provenance information. Update lists. Add genetlink constants.

netlink/constant.scm

11
;;;; This file is part of Guile Netlink
22
;;;;
3-
;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu>
3+
;;;; Copyright (C) 2020, 2025 Julien Lepiller <julien@lepiller.eu>
44
;;;; 
55
;;;; This library is free software: you can redistribute it and/or modify
66
;;;; it under the terms of the GNU General Public License as published by

5454
             (cond
5555
               #,@(map (lambda (s) (getter #'num s)) (spec-names #'(name-spec ...))))))))))
5656
57+
;; Defined in [kernel]/include/uapi/linux/if_link.h
5758
(define-enum int->link-attr-kind
5859
  IFLA_UNSPEC IFLA_ADDRESS IFLA_BROADCAST IFLA_IFNAME IFLA_MTU
5960
  IFLA_LINK IFLA_QDISC IFLA_STATS IFLA_COST IFLA_PRIORITY

6869
  IFLA_GSO_MAX_SEGS IFLA_GSO_MAX_SIZE IFLA_PAD IFLA_XDP
6970
  IFLA_EVENT IFLA_NEW_NETNSID IFLA_IF_NETNSID IFLA_CARRIER_UP_COUNT
7071
  IFLA_CARRIER_DOWN_COUNT IFLA_NEW_IFINDEX IFLA_MIN_MTU IFLA_MAX_MTU
71-
  IFLA_PROP_LIST IFLA_ALT_IFNAME IFLA_PERM_ADDRESS)
72+
  IFLA_PROP_LIST IFLA_ALT_IFNAME IFLA_PERM_ADDRESS IFLA_PROTO_DOWN_REASON
73+
  IFLA_PARENT_DEV_NAME IFLA_PARENT_DEV_BUS_NAME IFLA_GRO_MAX_SIZE
74+
  IFLA_TSO_MAX_SIZE IFLA_TSO_MAX_SEGS IFLA_ALLMULTI IFLA_DEVLINK_PORT
75+
  IFLA_GSO_IPV4_MAX_SIZE IFLA_GRO_IPV4_MAX_SIZE IFLA_DPLL_PIN)
7276
(define-public IFLA_TARGET_NETNSID IFLA_IF_NETNSID)
7377
78+
;; Defined in [kernel]/include/uapi/linux/if_link.h
7479
(define-enum int->linkinfo
7580
  IFLA_INFO_UNSPEC IFLA_INFO_KIND IFLA_INFO_DATA IFLA_INFO_XSTATS
7681
  IFLA_INFO_SLAVE_KIND IFLA_INFO_SLAVE_DATA)
7782
83+
;; Defined in [kernel]/include/uapi/linux/veth.h
7884
(define-enum int->veth-linkinfo
7985
  VETH_INFO_UNSPEC VETH_INFO_PEER)
8086
87+
;; Defined in [kernel]/include/uapi/linux/if_link.h
8188
(define-enum int->vlan-linkinfo
8289
  IFLA_VLAN_UNSPEC IFLA_VLAN_ID IFLA_VLAN_FLAGS IFLA_VLAN_EGRESS_QOS
8390
  IFLA_VLAN_INGRESS_QOS IFLA_VLAN_PROTOCOL)
8491
92+
;; Defined in [kernel]/include/uapi/linux/if_link.h
8593
(define-enum int->bond-linkinfo
8694
  IFLA_BOND_UNSPEC IFLA_BOND_MODE IFLA_BOND_ACTIVE_SLAVE IFLA_BOND_MIIMON
8795
  IFLA_BOND_UPDELAY IFLA_BOND_DOWNDELAY IFLA_BOND_USE_CARRIER IFLA_BOND_ARP_INTERVAL

94102
  IFLA_BOND_PEER_NOTIF_DELAY IFLA_BOND_AD_LACP_ACTIVE IFLA_BOND_MISSED_MAX IFLA_BOND_NS_IP6_TARGET)
95103
96104
;; see iproute2/ip/iplink_bond.c for mode_tbl
105+
;; Defined in [kernel]/include/uapi/linux/if_bonding.h
97106
(define-enum int->bond-mode
98107
  BOND_MODE_ROUNDROBIN BOND_MODE_ACTIVEBACKUP BOND_MODE_XOR BOND_MODE_BROADCAST
99108
  BOND_MODE_8023AD BOND_MODE_TLB
100109
  ;; TLB + RLB (receive load balancing)
101110
  BOND_MODE_ALB)
102111
103-
;; see iproute2/ip/iplink_bond.c primary_reselect_tbl
112+
;; Defined in [kernel]/include/net/bonding.h
104113
(define-public BOND_PRIMARY_RESELECT_ALWAYS 0)
105114
(define-public BOND_PRIMARY_RESELECT_BETTER 1)
106115
(define-public BOND_PRIMARY_RESELECT_FAILURE 2)

109118
(define-public BOND_AD_LACP_ACTIVE_OFF 0)
110119
(define-public BOND_AD_LACP_ACTIVE_ON 1)
111120
121+
;; Defined in [kernel]/include/uapi/linux/if_addr.h
112122
(define-enum int->addr-attr-kind
113123
  IFA_UNSPEC IFA_ADDRESS IFA_LOCAL IFA_LABEL IFA_BROADCAST
114124
  IFA_ANYCAST IFA_CACHEINFO IFA_MULTICAST IFA_FLAGS
115-
  IFA_RT_PRIORITY IFA_TARGET_NETNSID)
125+
  IFA_RT_PRIORITY IFA_TARGET_NETNSID IFA_PROTO)
116126
127+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
117128
(define-enum int->route-attr-kind
118129
  RTA_UNSPEC RTA_DST RTA_SRC RTA_IIF RTA_OIF RTA_GATEWAY
119130
  RTA_PRIORITY RTA_PREFSRC RTA_METRICS RTA_MULTIPATH

125136
(define-public AF_NETLINK 16)
126137
(define-public AF_PACKET 17)
127138
139+
;; Defined in [kernel]/include/uapi/linux/netlink.h
128140
(define-enum int->protocol
129141
  NETLINK_ROUTE NETLINK_UNUSED NETLINK_USERSOCK NETLINK_FIREWALL
130142
  NETLINK_SOCK_DIAG NETLINK_NFLOG NETLINK_XFRM NETLINK_SELINUX

135147
(define-public NETLINK_INET_DIAG NETLINK_SOCK_DIAG)
136148
137149
(define-enum int->message-kind
150+
;; Defined in [kernel]/include/uapi/linux/netlink.h
138151
  (NLMSG_NOOP 1)
139152
  NLMSG_ERROR
140153
  NLMSG_DONE
141154
  NLMSG_OVERUN
142155
  
156+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
143157
  (RTM_NEWLINK 16)
144158
  RTM_DELLINK
145159
  RTM_GETLINK

225239
  RTM_DELVLAN
226240
  RTM_GETVLAN)
227241
242+
;; Defined in [kernel]/include/uapi/linux/netlink.h
228243
(define-public NLM_F_REQUEST #x01)
229244
(define-public NLM_F_MULTI #x02)
230245
(define-public NLM_F_ACK #x04)

250265
(define-public NLM_F_ACK_TLVS #x200)
251266
252267
;; net_device_flags
268+
;; Defined in [kernel]/include/uapi/linux/if.h
253269
(define-enum int->device-flags
254270
  (IFF_UP 1)
255271
  (IFF_BROADCAST 2)

272288
  (IFF_ECHO 262144))
273289
274290
;; operstate
291+
;; Defined in [kernel]/include/uapi/linux/if.h
275292
(define-enum int->operstate
276293
  IF_OPER_UNKNOWN IF_OPER_NOTPRESENT IF_OPER_DOWN
277294
  IF_OPER_LOWERLAYERDOWN IF_OPER_TESTING IF_OPER_DORMANT
278295
  IF_OPER_UP)
279296
280297
;; ifa_flags
298+
;; Defined in [kernel]/include/uapi/linux/if_addr.h
281299
(define-enum int->ifa-flag
282300
  (IFA_F_SECONDARY      #x01)
283301
  (IFA_F_TEMPORARY      #x01) 

295313
296314
297315
;; rtm_type
316+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
298317
(define-enum int->rtm-type
299318
  RTN_UNSPEC RTN_UNICAST RTN_LOCAL RTN_BROADCAST RTN_ANYCAST
300319
  RTN_MULTICAST RTN_BLACKHOLE RTN_UNREACHABLE RTN_PROHIBIT
301320
  RTN_THROW RTN_NAT RTN_XRESOLVE)
302321
303322
;; rtm_protocol
323+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
304324
(define-enum int->rtm-protocol
305325
  RTPROT_UNSPEC RTPROT_REDIRECT RTPROT_KERNEL RTPROT_BOOT RTPROT_STATIC
306326
  ;; not interpreted by the kernel, but returned anyway.

313333
  (RTPROT_EIGRP 192))
314334
315335
;; rtm_scope
336+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
316337
(define-enum int->rtm-scope
317338
  RT_SCOPE_UNIVERSE
318339
  (RT_SCOPE_SITE 200)

321342
  (RT_SCOPE_NOWHERE 255))
322343
323344
;; rtm_flags
345+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
324346
(define-enum int->rtm-flag
325347
  (RTM_F_NOTIFY #x100)
326348
  (RTM_F_CLONED #x200)

333355
334356
335357
;; rtm_table
358+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
336359
(define-enum int->rtm-table
337360
  RT_TABLE_UNSPEC
338361
  (RT_TABLE_COMPAT 252)

341364
  (RT_TABLE_LOCAL 255))
342365
343366
;; link type
344-
;; more at include/uapi/linux/if_arp.h
367+
;; Defined in [kernel]/include/uapi/linux/if_arp.h
345368
(define-enum int->link-type
346369
  (ARPHRD_ETHER 1)
347370
  (ARPHRD_LOOPBACK 772))
348371
349372
;; enum rtnetlink_groups
373+
;; Defined in [kernel]/include/uapi/linux/rtnetlink.h
350374
(define-enum int->rtnetlink-group
351375
  (RTNLGRP_NONE 0)
352376
  RTNLGRP_LINK

385409
  RTNLGRP_MCTP_IFADDR
386410
  RTNLGRP_TUNNEL
387411
  RTNLGRP_STATS)
412+
413+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
414+
(define-enum int->genetlink-command
415+
  (CTRL_CMD_UNSPEC 0)
416+
  CTRL_CMD_NEWFAMILY
417+
  CTRL_CMD_DELFAMILY
418+
  CTRL_CMD_GETFAMILY
419+
  CTRL_CMD_NEWOPS
420+
  CTRL_CMD_DELOPS
421+
  CTRL_CMD_GETOPS
422+
  CTRL_CMD_NEWMCAST_GRP
423+
  CTRL_CMD_DELMCAST_GRP
424+
  CTRL_CMD_GETMCAST_GRP
425+
  CTRL_CMD_GETPOLICY)
426+
427+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
428+
(define-enum int->genetlink-attr
429+
  (CTRL_ATTR_UNSPEC 0)
430+
  CTRL_ATTR_FAMILY_ID
431+
  CTRL_ATTR_FAMILY_NAME
432+
  CTRL_ATTR_VERSION
433+
  CTRL_ATTR_HDRSIZE
434+
  CTRL_ATTR_MAXATTR
435+
  CTRL_ATTR_OPS
436+
  CTRL_ATTR_MCAST_GROUPS
437+
  CTRL_ATTR_POLICY
438+
  CTRL_ATTR_OP_POLICY
439+
  CTRL_ATTR_OP)
440+
441+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
442+
(define-enum int->genetlink-attr-op
443+
  (CTRL_ATTR_OP_UNSPEC 0)
444+
  CTRL_ATTR_OP_ID
445+
  CTRL_ATTR_OP_FLAGS)
446+
447+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
448+
(define-enum int->genetlink-attr-mcast
449+
  (CTRL_ATTR_MCAST_GRP_UNSPEC 0)
450+
  CTRL_ATTR_MCAST_GRP_NAME
451+
  CTRL_ATTR_MCAST_GRP_ID)
452+
453+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
454+
(define-enum int->genetlink-attr-policy
455+
  (CTRL_ATTR_POLICY_UNSPEC 0)
456+
  CTRL_ATTR_POLICY_DO
457+
  CTRL_ATTR_POLICY_DUMP)
458+
459+
;; Defined in [kernel]/include/uapi/linux/genetlink.h
460+
(define-enum int->genetlink-identifiers
461+
  (GENL_ID_CTRL #x10)
462+
  GENL_ID_VFS_DQUOT
463+
  GENL_ID_PMCRAID)