firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
useful_functions.c File Reference
#include "include/ebtables_u.h"
#include "include/ethernetdb.h"
#include <stdio.h>
#include <netinet/ether.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
Include dependency graph for useful_functions.c:


void ebt_print_mac (const unsigned char *mac)
void ebt_print_mac_and_mask (const unsigned char *mac, const unsigned char *mask)
struct ethertypeentparseethertypebynumber (int type)
int ebt_get_mac_and_mask (const char *from, unsigned char *to, unsigned char *mask)
int _ebt_check_inverse (const char option[], int argc, char **argv)
void ebt_check_option (unsigned int *flags, unsigned int mask)
void ebt_parse_ip_address (char *address, uint32_t *addr, uint32_t *msk)
char * ebt_mask_to_dotted (uint32_t mask)
int string_to_number_ll (const char *s, unsigned long long min, unsigned long long max, unsigned long long *ret)
int string_to_number_l (const char *s, unsigned long min, unsigned long max, unsigned long *ret)
int string_to_number (const char *s, unsigned int min, unsigned int max, unsigned int *ret)
void ebt_parse_ip6_address (char *address, struct in6_addr *addr, struct in6_addr *msk)
char * ebt_ip6_to_numeric (const struct in6_addr *addrp)
char * ebt_ip6_mask_to_string (const struct in6_addr *msk)


const unsigned char mac_type_unicast [ETH_ALEN] = {0,0,0,0,0,0}
const unsigned char msk_type_unicast [ETH_ALEN] = {1,0,0,0,0,0}
const unsigned char mac_type_multicast [ETH_ALEN] = {1,0,0,0,0,0}
const unsigned char msk_type_multicast [ETH_ALEN] = {1,0,0,0,0,0}
const unsigned char mac_type_broadcast [ETH_ALEN] = {255,255,255,255,255,255}
const unsigned char msk_type_broadcast [ETH_ALEN] = {255,255,255,255,255,255}
const unsigned char mac_type_bridge_group [ETH_ALEN] = {0x01,0x80,0xc2,0,0,0}
const unsigned char msk_type_bridge_group [ETH_ALEN] = {255,255,255,255,255,255}
int ebt_printstyle_mac
int ebt_invert = 0

Function Documentation

int _ebt_check_inverse ( const char  option[],
int  argc,
char **  argv 

References ebt_invert, ebt_print_error, and NULL.

void ebt_check_option ( unsigned int *  flags,
unsigned int  mask 

References ebt_print_error, and mask.

int ebt_get_mac_and_mask ( const char *  from,
unsigned char *  to,
unsigned char *  mask 
char* ebt_ip6_mask_to_string ( const struct in6_addr *  msk)

References buf, and ebt_ip6_to_numeric().

Here is the call graph for this function:

char* ebt_ip6_to_numeric ( const struct in6_addr *  addrp)

Referenced by ebt_ip6_mask_to_string().

Here is the caller graph for this function:

char* ebt_mask_to_dotted ( uint32_t  mask)

References buf.

void ebt_parse_ip6_address ( char *  address,
struct in6_addr *  addr,
struct in6_addr *  msk 

References buf, ebt_print_error, and NULL.

void ebt_parse_ip_address ( char *  address,
uint32_t *  addr,
uint32_t *  msk 

References ebt_print_error, and NULL.

void ebt_print_mac ( const unsigned char *  mac)

References ebt_printstyle_mac, and ETH_ALEN.

Referenced by ebt_print_mac_and_mask().

Here is the caller graph for this function:

void ebt_print_mac_and_mask ( const unsigned char *  mac,
const unsigned char *  mask 
struct ethertypeent* parseethertypebynumber ( int  type)

References ebt_print_error, and getethertypebynumber().

Here is the call graph for this function:

int string_to_number ( const char *  s,
unsigned int  min,
unsigned int  max,
unsigned int *  ret 

References string_to_number_l().

Here is the call graph for this function:

int string_to_number_l ( const char *  s,
unsigned long  min,
unsigned long  max,
unsigned long *  ret 

References string_to_number_ll().

Referenced by string_to_number().

Here is the call graph for this function:

Here is the caller graph for this function:

int string_to_number_ll ( const char *  s,
unsigned long long  min,
unsigned long long  max,
unsigned long long *  ret 

Referenced by ipset_parse_timeout(), ipset_parse_uint64(), and string_to_number_l().

Here is the caller graph for this function:

Variable Documentation

int ebt_invert = 0

Referenced by _ebt_check_inverse(), and do_command().

int ebt_printstyle_mac

Referenced by ebt_print_mac().

const unsigned char mac_type_bridge_group[ETH_ALEN] = {0x01,0x80,0xc2,0,0,0}
const unsigned char mac_type_broadcast[ETH_ALEN] = {255,255,255,255,255,255}
const unsigned char mac_type_multicast[ETH_ALEN] = {1,0,0,0,0,0}
const unsigned char mac_type_unicast[ETH_ALEN] = {0,0,0,0,0,0}
const unsigned char msk_type_bridge_group[ETH_ALEN] = {255,255,255,255,255,255}
const unsigned char msk_type_broadcast[ETH_ALEN] = {255,255,255,255,255,255}
const unsigned char msk_type_multicast[ETH_ALEN] = {1,0,0,0,0,0}
const unsigned char msk_type_unicast[ETH_ALEN] = {1,0,0,0,0,0}