Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| ifreq_ethtool [2018/09/02 06:21] – created rpjday | ifreq_ethtool [2018/09/02 06:56] (current) – [Userspace and struct ifreq] rpjday | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| Notes on '' | Notes on '' | ||
| - | Links: | + | General links: |
| * [[https:// | * [[https:// | ||
| + | |||
| + | Kernel source links: | ||
| + | |||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | ===== Userspace and struct ifreq ===== | ||
| + | |||
| + | From ethtool' | ||
| + | |||
| + | < | ||
| + | /* Context for sub-commands */ | ||
| + | struct cmd_context { | ||
| + | const char *devname; | ||
| + | int fd; /* socket suitable for ethtool ioctl */ | ||
| + | struct ifreq ifr; /* ifreq suitable for ethtool ioctl */ | ||
| + | int argc; /* number of arguments to the sub-command */ | ||
| + | char **argp; | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | and from '' | ||
| + | |||
| + | < | ||
| + | #ifndef TEST_ETHTOOL | ||
| + | int send_ioctl(struct cmd_context *ctx, void *cmd) | ||
| + | { | ||
| + | ctx-> | ||
| + | return ioctl(ctx-> | ||
| + | } | ||
| + | #endif | ||
| + | </ | ||
| + | |||
| + | From '' | ||
| + | |||
| + | < | ||
| + | /* for compatibility with glibc net/if.h */ | ||
| + | #if __UAPI_DEF_IF_IFREQ | ||
| + | struct ifreq { | ||
| + | #define IFHWADDRLEN | ||
| + | union | ||
| + | { | ||
| + | char ifrn_name[IFNAMSIZ]; | ||
| + | } ifr_ifrn; | ||
| + | |||
| + | union { | ||
| + | struct | ||
| + | struct | ||
| + | struct | ||
| + | struct | ||
| + | struct | ||
| + | short | ||
| + | int | ||
| + | int | ||
| + | struct | ||
| + | char ifru_slave[IFNAMSIZ]; | ||
| + | char ifru_newname[IFNAMSIZ]; | ||
| + | void * ifru_data; | ||
| + | struct | ||
| + | } ifr_ifru; | ||
| + | }; | ||
| + | #endif /* __UAPI_DEF_IF_IFREQ */ | ||
| + | |||
| + | #define ifr_name | ||
| + | #define ifr_hwaddr | ||
| + | #define ifr_addr | ||
| + | #define ifr_dstaddr | ||
| + | #define ifr_broadaddr | ||
| + | #define ifr_netmask | ||
| + | #define ifr_flags | ||
| + | #define ifr_metric | ||
| + | #define ifr_mtu | ||
| + | #define ifr_map | ||
| + | #define ifr_slave | ||
| + | #define ifr_data | ||
| + | #define ifr_ifindex | ||
| + | #define ifr_bandwidth | ||
| + | #define ifr_qlen | ||
| + | #define ifr_newname | ||
| + | #define ifr_settings | ||
| + | </ | ||