0001-uapi-Bring-in-if.h.patch 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. From fd02caa75918401f2cb75af1f2a181c1959e070d Mon Sep 17 00:00:00 2001
  2. From: Florian Fainelli <f.fainelli@gmail.com>
  3. Date: Sat, 14 Jan 2023 08:34:09 -0800
  4. Subject: [PATCH] uapi: Bring in if.h
  5. Bring in if.h from commit eec517cdb481 ("net: Add IF_OPER_TESTING") as
  6. well as uapi/linux/hdlc/ioctl.h. Ensure that we define all of the
  7. necessary guards to provide updated definitions of ifmap, ifreq and
  8. IFNAMSIZ. This resolves build issues with kernel headers < 4.11 which
  9. lacked 2618be7dccf8739b89e1906b64bd8d551af351e6 ("uapi: fix linux/if.h
  10. userspace compilation errors").
  11. Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
  12. Reported-by: Markus Mayer <mmayer@broadcom.com>
  13. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  14. Message-Id: <20230114163411.3290201-2-f.fainelli@gmail.com>
  15. [Upstream: https://patchwork.kernel.org/project/netdevbpf/patch/20230114163411.3290201-2-f.fainelli@gmail.com/]
  16. [vfazio@gmail.com: fix whitespace issues]
  17. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
  18. ---
  19. Makefile.am | 6 +-
  20. internal.h | 7 +-
  21. uapi/linux/hdlc/ioctl.h | 94 +++++++++++++
  22. uapi/linux/if.h | 296 ++++++++++++++++++++++++++++++++++++++++
  23. 4 files changed, 397 insertions(+), 6 deletions(-)
  24. create mode 100644 uapi/linux/hdlc/ioctl.h
  25. create mode 100644 uapi/linux/if.h
  26. diff --git a/Makefile.am b/Makefile.am
  27. index 663f40a..691a20e 100644
  28. --- a/Makefile.am
  29. +++ b/Makefile.am
  30. @@ -7,7 +7,8 @@ EXTRA_DIST = LICENSE ethtool.8 ethtool.spec.in aclocal.m4 ChangeLog autogen.sh
  31. sbin_PROGRAMS = ethtool
  32. ethtool_SOURCES = ethtool.c uapi/linux/ethtool.h internal.h \
  33. - uapi/linux/net_tstamp.h rxclass.c common.c common.h \
  34. + uapi/linux/net_tstamp.h uapi/linux/if.h uapi/linux/hdlc/ioctl.h \
  35. + rxclass.c common.c common.h \
  36. json_writer.c json_writer.h json_print.c json_print.h \
  37. list.h
  38. if ETHTOOL_ENABLE_PRETTY_DUMP
  39. @@ -43,7 +44,8 @@ ethtool_SOURCES += \
  40. netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \
  41. uapi/linux/ethtool_netlink.h \
  42. uapi/linux/netlink.h uapi/linux/genetlink.h \
  43. - uapi/linux/rtnetlink.h uapi/linux/if_link.h
  44. + uapi/linux/rtnetlink.h uapi/linux/if_link.h \
  45. + uapi/linux/if.h uapi/linux/hdlc/ioctl.h
  46. AM_CPPFLAGS += @MNL_CFLAGS@
  47. LDADD += @MNL_LIBS@
  48. endif
  49. diff --git a/internal.h b/internal.h
  50. index b80f77a..3923719 100644
  51. --- a/internal.h
  52. +++ b/internal.h
  53. @@ -21,6 +21,9 @@
  54. #include <unistd.h>
  55. #include <endian.h>
  56. #include <sys/ioctl.h>
  57. +#define __UAPI_DEF_IF_IFNAMSIZ 1
  58. +#define __UAPI_DEF_IF_IFMAP 1
  59. +#define __UAPI_DEF_IF_IFREQ 1
  60. #include <linux/if.h>
  61. #include "json_writer.h"
  62. @@ -52,10 +55,6 @@ typedef int32_t s32;
  63. #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
  64. #endif
  65. -#ifndef ALTIFNAMSIZ
  66. -#define ALTIFNAMSIZ 128
  67. -#endif
  68. -
  69. #include <linux/ethtool.h>
  70. #include <linux/net_tstamp.h>
  71. diff --git a/uapi/linux/hdlc/ioctl.h b/uapi/linux/hdlc/ioctl.h
  72. new file mode 100644
  73. index 0000000..b06341a
  74. --- /dev/null
  75. +++ b/uapi/linux/hdlc/ioctl.h
  76. @@ -0,0 +1,94 @@
  77. +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  78. +#ifndef __HDLC_IOCTL_H__
  79. +#define __HDLC_IOCTL_H__
  80. +
  81. +
  82. +#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */
  83. +
  84. +#define CLOCK_DEFAULT 0 /* Default setting */
  85. +#define CLOCK_EXT 1 /* External TX and RX clock - DTE */
  86. +#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */
  87. +#define CLOCK_TXINT 3 /* Internal TX and external RX clock */
  88. +#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */
  89. +
  90. +
  91. +#define ENCODING_DEFAULT 0 /* Default setting */
  92. +#define ENCODING_NRZ 1
  93. +#define ENCODING_NRZI 2
  94. +#define ENCODING_FM_MARK 3
  95. +#define ENCODING_FM_SPACE 4
  96. +#define ENCODING_MANCHESTER 5
  97. +
  98. +
  99. +#define PARITY_DEFAULT 0 /* Default setting */
  100. +#define PARITY_NONE 1 /* No parity */
  101. +#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */
  102. +#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */
  103. +#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */
  104. +#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */
  105. +#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */
  106. +#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */
  107. +
  108. +#define LMI_DEFAULT 0 /* Default setting */
  109. +#define LMI_NONE 1 /* No LMI, all PVCs are static */
  110. +#define LMI_ANSI 2 /* ANSI Annex D */
  111. +#define LMI_CCITT 3 /* ITU-T Annex A */
  112. +#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */
  113. +
  114. +#ifndef __ASSEMBLY__
  115. +
  116. +typedef struct {
  117. + unsigned int clock_rate; /* bits per second */
  118. + unsigned int clock_type; /* internal, external, TX-internal etc. */
  119. + unsigned short loopback;
  120. +} sync_serial_settings; /* V.35, V.24, X.21 */
  121. +
  122. +typedef struct {
  123. + unsigned int clock_rate; /* bits per second */
  124. + unsigned int clock_type; /* internal, external, TX-internal etc. */
  125. + unsigned short loopback;
  126. + unsigned int slot_map;
  127. +} te1_settings; /* T1, E1 */
  128. +
  129. +typedef struct {
  130. + unsigned short encoding;
  131. + unsigned short parity;
  132. +} raw_hdlc_proto;
  133. +
  134. +typedef struct {
  135. + unsigned int t391;
  136. + unsigned int t392;
  137. + unsigned int n391;
  138. + unsigned int n392;
  139. + unsigned int n393;
  140. + unsigned short lmi;
  141. + unsigned short dce; /* 1 for DCE (network side) operation */
  142. +} fr_proto;
  143. +
  144. +typedef struct {
  145. + unsigned int dlci;
  146. +} fr_proto_pvc; /* for creating/deleting FR PVCs */
  147. +
  148. +typedef struct {
  149. + unsigned int dlci;
  150. + char master[IFNAMSIZ]; /* Name of master FRAD device */
  151. +}fr_proto_pvc_info; /* for returning PVC information only */
  152. +
  153. +typedef struct {
  154. + unsigned int interval;
  155. + unsigned int timeout;
  156. +} cisco_proto;
  157. +
  158. +typedef struct {
  159. + unsigned short dce; /* 1 for DCE (network side) operation */
  160. + unsigned int modulo; /* modulo (8 = basic / 128 = extended) */
  161. + unsigned int window; /* frame window size */
  162. + unsigned int t1; /* timeout t1 */
  163. + unsigned int t2; /* timeout t2 */
  164. + unsigned int n2; /* frame retry counter */
  165. +} x25_hdlc_proto;
  166. +
  167. +/* PPP doesn't need any info now - supply length = 0 to ioctl */
  168. +
  169. +#endif /* __ASSEMBLY__ */
  170. +#endif /* __HDLC_IOCTL_H__ */
  171. diff --git a/uapi/linux/if.h b/uapi/linux/if.h
  172. new file mode 100644
  173. index 0000000..75ee7f4
  174. --- /dev/null
  175. +++ b/uapi/linux/if.h
  176. @@ -0,0 +1,296 @@
  177. +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  178. +/*
  179. + * INET An implementation of the TCP/IP protocol suite for the LINUX
  180. + * operating system. INET is implemented using the BSD Socket
  181. + * interface as the means of communication with the user level.
  182. + *
  183. + * Global definitions for the INET interface module.
  184. + *
  185. + * Version: @(#)if.h 1.0.2 04/18/93
  186. + *
  187. + * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988
  188. + * Ross Biro
  189. + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  190. + *
  191. + * This program is free software; you can redistribute it and/or
  192. + * modify it under the terms of the GNU General Public License
  193. + * as published by the Free Software Foundation; either version
  194. + * 2 of the License, or (at your option) any later version.
  195. + */
  196. +#ifndef _LINUX_IF_H
  197. +#define _LINUX_IF_H
  198. +
  199. +#include <linux/libc-compat.h> /* for compatibility with glibc */
  200. +#include <linux/types.h> /* for "__kernel_caddr_t" et al */
  201. +#include <linux/socket.h> /* for "struct sockaddr" et al */
  202. + /* for "__user" et al */
  203. +
  204. +#include <sys/socket.h> /* for struct sockaddr. */
  205. +
  206. +#if __UAPI_DEF_IF_IFNAMSIZ
  207. +#define IFNAMSIZ 16
  208. +#endif /* __UAPI_DEF_IF_IFNAMSIZ */
  209. +#define IFALIASZ 256
  210. +#define ALTIFNAMSIZ 128
  211. +#include <linux/hdlc/ioctl.h>
  212. +
  213. +/* For glibc compatibility. An empty enum does not compile. */
  214. +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
  215. + __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
  216. +/**
  217. + * enum net_device_flags - &struct net_device flags
  218. + *
  219. + * These are the &struct net_device flags, they can be set by drivers, the
  220. + * kernel and some can be triggered by userspace. Userspace can query and
  221. + * set these flags using userspace utilities but there is also a sysfs
  222. + * entry available for all dev flags which can be queried and set. These flags
  223. + * are shared for all types of net_devices. The sysfs entries are available
  224. + * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
  225. + * are annotated below, note that only a few flags can be toggled and some
  226. + * other flags are always preserved from the original net_device flags
  227. + * even if you try to set them via sysfs. Flags which are always preserved
  228. + * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__
  229. + * are annotated below as such.
  230. + *
  231. + * You should have a pretty good reason to be extending these flags.
  232. + *
  233. + * @IFF_UP: interface is up. Can be toggled through sysfs.
  234. + * @IFF_BROADCAST: broadcast address valid. Volatile.
  235. + * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
  236. + * @IFF_LOOPBACK: is a loopback net. Volatile.
  237. + * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
  238. + * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
  239. + * Volatile.
  240. + * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
  241. + * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
  242. + * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
  243. + * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
  244. + * sysfs.
  245. + * @IFF_MASTER: master of a load balancer. Volatile.
  246. + * @IFF_SLAVE: slave of a load balancer. Volatile.
  247. + * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
  248. + * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
  249. + * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
  250. + * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
  251. + * through sysfs.
  252. + * @IFF_LOWER_UP: driver signals L1 up. Volatile.
  253. + * @IFF_DORMANT: driver signals dormant. Volatile.
  254. + * @IFF_ECHO: echo sent packets. Volatile.
  255. + */
  256. +enum net_device_flags {
  257. +/* for compatibility with glibc net/if.h */
  258. +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
  259. + IFF_UP = 1<<0, /* sysfs */
  260. + IFF_BROADCAST = 1<<1, /* __volatile__ */
  261. + IFF_DEBUG = 1<<2, /* sysfs */
  262. + IFF_LOOPBACK = 1<<3, /* __volatile__ */
  263. + IFF_POINTOPOINT = 1<<4, /* __volatile__ */
  264. + IFF_NOTRAILERS = 1<<5, /* sysfs */
  265. + IFF_RUNNING = 1<<6, /* __volatile__ */
  266. + IFF_NOARP = 1<<7, /* sysfs */
  267. + IFF_PROMISC = 1<<8, /* sysfs */
  268. + IFF_ALLMULTI = 1<<9, /* sysfs */
  269. + IFF_MASTER = 1<<10, /* __volatile__ */
  270. + IFF_SLAVE = 1<<11, /* __volatile__ */
  271. + IFF_MULTICAST = 1<<12, /* sysfs */
  272. + IFF_PORTSEL = 1<<13, /* sysfs */
  273. + IFF_AUTOMEDIA = 1<<14, /* sysfs */
  274. + IFF_DYNAMIC = 1<<15, /* sysfs */
  275. +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
  276. +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
  277. + IFF_LOWER_UP = 1<<16, /* __volatile__ */
  278. + IFF_DORMANT = 1<<17, /* __volatile__ */
  279. + IFF_ECHO = 1<<18, /* __volatile__ */
  280. +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
  281. +};
  282. +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
  283. +
  284. +/* for compatibility with glibc net/if.h */
  285. +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
  286. +#define IFF_UP IFF_UP
  287. +#define IFF_BROADCAST IFF_BROADCAST
  288. +#define IFF_DEBUG IFF_DEBUG
  289. +#define IFF_LOOPBACK IFF_LOOPBACK
  290. +#define IFF_POINTOPOINT IFF_POINTOPOINT
  291. +#define IFF_NOTRAILERS IFF_NOTRAILERS
  292. +#define IFF_RUNNING IFF_RUNNING
  293. +#define IFF_NOARP IFF_NOARP
  294. +#define IFF_PROMISC IFF_PROMISC
  295. +#define IFF_ALLMULTI IFF_ALLMULTI
  296. +#define IFF_MASTER IFF_MASTER
  297. +#define IFF_SLAVE IFF_SLAVE
  298. +#define IFF_MULTICAST IFF_MULTICAST
  299. +#define IFF_PORTSEL IFF_PORTSEL
  300. +#define IFF_AUTOMEDIA IFF_AUTOMEDIA
  301. +#define IFF_DYNAMIC IFF_DYNAMIC
  302. +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */
  303. +
  304. +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
  305. +#define IFF_LOWER_UP IFF_LOWER_UP
  306. +#define IFF_DORMANT IFF_DORMANT
  307. +#define IFF_ECHO IFF_ECHO
  308. +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
  309. +
  310. +#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
  311. + IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
  312. +
  313. +#define IF_GET_IFACE 0x0001 /* for querying only */
  314. +#define IF_GET_PROTO 0x0002
  315. +
  316. +/* For definitions see hdlc.h */
  317. +#define IF_IFACE_V35 0x1000 /* V.35 serial interface */
  318. +#define IF_IFACE_V24 0x1001 /* V.24 serial interface */
  319. +#define IF_IFACE_X21 0x1002 /* X.21 serial interface */
  320. +#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */
  321. +#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */
  322. +#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */
  323. +#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */
  324. +
  325. +/* For definitions see hdlc.h */
  326. +#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */
  327. +#define IF_PROTO_PPP 0x2001 /* PPP protocol */
  328. +#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */
  329. +#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */
  330. +#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */
  331. +#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */
  332. +#define IF_PROTO_X25 0x2006 /* X.25 */
  333. +#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */
  334. +#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */
  335. +#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */
  336. +#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */
  337. +#define IF_PROTO_FR_ETH_PVC 0x200B
  338. +#define IF_PROTO_RAW 0x200C /* RAW Socket */
  339. +
  340. +/* RFC 2863 operational status */
  341. +enum {
  342. + IF_OPER_UNKNOWN,
  343. + IF_OPER_NOTPRESENT,
  344. + IF_OPER_DOWN,
  345. + IF_OPER_LOWERLAYERDOWN,
  346. + IF_OPER_TESTING,
  347. + IF_OPER_DORMANT,
  348. + IF_OPER_UP,
  349. +};
  350. +
  351. +/* link modes */
  352. +enum {
  353. + IF_LINK_MODE_DEFAULT,
  354. + IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */
  355. + IF_LINK_MODE_TESTING, /* limit upward transition to testing */
  356. +};
  357. +
  358. +/*
  359. + * Device mapping structure. I'd just gone off and designed a
  360. + * beautiful scheme using only loadable modules with arguments
  361. + * for driver options and along come the PCMCIA people 8)
  362. + *
  363. + * Ah well. The get() side of this is good for WDSETUP, and it'll
  364. + * be handy for debugging things. The set side is fine for now and
  365. + * being very small might be worth keeping for clean configuration.
  366. + */
  367. +
  368. +/* for compatibility with glibc net/if.h */
  369. +#if __UAPI_DEF_IF_IFMAP
  370. +struct ifmap {
  371. + unsigned long mem_start;
  372. + unsigned long mem_end;
  373. + unsigned short base_addr;
  374. + unsigned char irq;
  375. + unsigned char dma;
  376. + unsigned char port;
  377. + /* 3 bytes spare */
  378. +};
  379. +#endif /* __UAPI_DEF_IF_IFMAP */
  380. +
  381. +struct if_settings {
  382. + unsigned int type; /* Type of physical device or protocol */
  383. + unsigned int size; /* Size of the data allocated by the caller */
  384. + union {
  385. + /* {atm/eth/dsl}_settings anyone ? */
  386. + raw_hdlc_proto *raw_hdlc;
  387. + cisco_proto *cisco;
  388. + fr_proto *fr;
  389. + fr_proto_pvc *fr_pvc;
  390. + fr_proto_pvc_info *fr_pvc_info;
  391. + x25_hdlc_proto *x25;
  392. +
  393. + /* interface settings */
  394. + sync_serial_settings *sync;
  395. + te1_settings *te1;
  396. + } ifs_ifsu;
  397. +};
  398. +
  399. +/*
  400. + * Interface request structure used for socket
  401. + * ioctl's. All interface ioctl's must have parameter
  402. + * definitions which begin with ifr_name. The
  403. + * remainder may be interface specific.
  404. + */
  405. +
  406. +/* for compatibility with glibc net/if.h */
  407. +#if __UAPI_DEF_IF_IFREQ
  408. +struct ifreq {
  409. +#define IFHWADDRLEN 6
  410. + union
  411. + {
  412. + char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
  413. + } ifr_ifrn;
  414. +
  415. + union {
  416. + struct sockaddr ifru_addr;
  417. + struct sockaddr ifru_dstaddr;
  418. + struct sockaddr ifru_broadaddr;
  419. + struct sockaddr ifru_netmask;
  420. + struct sockaddr ifru_hwaddr;
  421. + short ifru_flags;
  422. + int ifru_ivalue;
  423. + int ifru_mtu;
  424. + struct ifmap ifru_map;
  425. + char ifru_slave[IFNAMSIZ]; /* Just fits the size */
  426. + char ifru_newname[IFNAMSIZ];
  427. + void * ifru_data;
  428. + struct if_settings ifru_settings;
  429. + } ifr_ifru;
  430. +};
  431. +#endif /* __UAPI_DEF_IF_IFREQ */
  432. +
  433. +#define ifr_name ifr_ifrn.ifrn_name /* interface name */
  434. +#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
  435. +#define ifr_addr ifr_ifru.ifru_addr /* address */
  436. +#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
  437. +#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
  438. +#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
  439. +#define ifr_flags ifr_ifru.ifru_flags /* flags */
  440. +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */
  441. +#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
  442. +#define ifr_map ifr_ifru.ifru_map /* device map */
  443. +#define ifr_slave ifr_ifru.ifru_slave /* slave device */
  444. +#define ifr_data ifr_ifru.ifru_data /* for use by interface */
  445. +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
  446. +#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
  447. +#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
  448. +#define ifr_newname ifr_ifru.ifru_newname /* New name */
  449. +#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/
  450. +
  451. +/*
  452. + * Structure used in SIOCGIFCONF request.
  453. + * Used to retrieve interface configuration
  454. + * for machine (useful for programs which
  455. + * must know all networks accessible).
  456. + */
  457. +
  458. +/* for compatibility with glibc net/if.h */
  459. +#if __UAPI_DEF_IF_IFCONF
  460. +struct ifconf {
  461. + int ifc_len; /* size of buffer */
  462. + union {
  463. + char *ifcu_buf;
  464. + struct ifreq *ifcu_req;
  465. + } ifc_ifcu;
  466. +};
  467. +#endif /* __UAPI_DEF_IF_IFCONF */
  468. +
  469. +#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
  470. +#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
  471. +
  472. +#endif /* _LINUX_IF_H */
  473. --
  474. 2.25.1