#include <arpa/inet.h>
#include <linux/if.h>
#include <linux/if_tun.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "netdevice.h"
#include "iwc_print.h"
Go to the source code of this file.
Defines | |
#define | PROC_IFINET6 "/proc/net/if_inet6" |
#define | IPV6_ADDR_LOOPBACK 0x0010U |
#define | IPV6_ADDR_LINKLOCAL 0x0020U |
#define | IPV6_ADDR_SITELOCAL 0x0040U |
#define | IPV6_ADDR_COMPATv4 0x0080U |
Functions | |
int | init_udp_socket (void) |
int | get_mac_by_dev (unsigned char *mac, const char *dev_name) |
int | get_ip_by_dev (addr_storage *addr, const char *dev_name) |
int | get_mtu_by_dev (const char *dev_name) |
int | bind_net_socket (const struct addrinfo *addr) |
int | open_tap_socket (const char *dev_name) |
Variables | |
int | ip_family |
int | skfd = -1 |
Definition in file netdevice.c.
#define IPV6_ADDR_COMPATv4 0x0080U |
Definition at line 36 of file netdevice.c.
#define IPV6_ADDR_LINKLOCAL 0x0020U |
Definition at line 34 of file netdevice.c.
#define IPV6_ADDR_LOOPBACK 0x0010U |
Definition at line 33 of file netdevice.c.
#define IPV6_ADDR_SITELOCAL 0x0040U |
Definition at line 35 of file netdevice.c.
#define PROC_IFINET6 "/proc/net/if_inet6" |
Definition at line 32 of file netdevice.c.
int bind_net_socket | ( | const struct addrinfo * | addr | ) |
Create UDP network socket and bind to given address
addr | Address info structure to bind socket |
Definition at line 206 of file netdevice.c.
int get_ip_by_dev | ( | addr_storage * | addr, | |
const char * | dev_name | |||
) |
Return IP address of a given interface
addr | Struct to fill in IP address (sockaddr_in or sockaddr_in6) | |
dev_name | Device name of requested address |
Definition at line 93 of file netdevice.c.
int get_mac_by_dev | ( | unsigned char * | mac, | |
const char * | dev_name | |||
) |
Return the MAC address of the given interface
mac | 6 bytes char array to fill in the MAC address | |
dev_name | Device name of requested address |
Definition at line 67 of file netdevice.c.
int get_mtu_by_dev | ( | const char * | dev_name | ) |
Return the MTU of the given interfaces
dev_name | Virtual wireless device name |
Definition at line 181 of file netdevice.c.
int init_udp_socket | ( | void | ) |
Initialize UPD socket file descriptor (IPv4 or IPv6)
Definition at line 52 of file netdevice.c.
int open_tap_socket | ( | const char * | dev_name | ) |
Return file descriptor for TAP device
dev_name | Virtual wireless device name |
Definition at line 232 of file netdevice.c.
int ip_family |
IP protocol version to use (AF_INET for IPv4, AF_INET6 for IPv6)
Definition at line 96 of file iwconnect.c.
int skfd = -1 |
Definition at line 42 of file netdevice.c.