/home/aaron/olsrd-current/olsrd/lib/bmf/src/NetworkInterfaces.c File Reference

#include "NetworkInterfaces.h"
#include <stddef.h>
#include <syslog.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <assert.h>
#include <net/if.h>
#include <netinet/in.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/if_tun.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <stdlib.h>
#include <stdio.h>
#include "olsr.h"
#include "ipcalc.h"
#include "defs.h"
#include "link_set.h"
#include "tc_set.h"
#include "net_olsr.h"
#include "lq_plugin.h"
#include "olsr_ip_prefix_list.h"
#include "olsr_logging.h"
#include "Packet.h"
#include "Bmf.h"
#include "Address.h"
Include dependency graph for NetworkInterfaces.c:

Go to the source code of this file.

Defines

#define ETHERTUNTAPIPNOTSET   0
#define IPV4_MAX_ADDRLEN   16
#define IPV4_MAX_PREFIXLEN   32
#define MAX_NON_OLSR_IFS   32

Functions

int SetBmfInterfaceName (const char *ifname, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused)))
int SetBmfInterfaceIp (const char *ip, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused)))
int SetCapturePacketsOnOlsrInterfaces (const char *enable, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused)))
int SetBmfMechanism (const char *mechanism, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused)))
static void AddDescriptorToInputSet (int skfd)
int DeactivateSpoofFilter (void)
void RestoreSpoofFilter (void)
void FindNeighbors (struct TBestNeighbors *neighbors, struct link_entry **bestNeighbor, struct TBmfInterface *intf, union olsr_ip_addr *source, union olsr_ip_addr *forwardedBy, union olsr_ip_addr *forwardedTo, int *nPossibleNeighbors)
static int CreateCaptureSocket (const char *ifName)
static int CreateListeningSocket (const char *ifName)
static int CreateEncapsulateSocket (const char *ifName)
static int CreateLocalEtherTunTap (void)
static int CreateInterface (const char *ifName, struct interface *olsrIntf)
int CreateBmfNetworkInterfaces (struct interface *skipThisIntf)
void AddInterface (struct interface *newIntf)
void CloseBmfNetworkInterfaces (void)
int AddNonOlsrBmfIf (const char *ifName, void *data __attribute__((unused)), set_plugin_parameter_addon addon __attribute__((unused)))
int IsNonOlsrBmfIf (const char *ifName)
void CheckAndUpdateLocalBroadcast (unsigned char *ipPacket, union olsr_ip_addr *broadAddr)
void AddMulticastRoute (void)
void DeleteMulticastRoute (void)

Variables

struct TBmfInterfaceBmfInterfaces = NULL
struct TBmfInterfaceLastBmfInterface = NULL
int HighestSkfd = -1
fd_set InputSet
int EtherTunTapFd = -1
char EtherTunTapIfName [IFNAMSIZ] = "bmf0"
enum TBmfMechanism BmfMechanism = BM_BROADCAST
u_int32_t EtherTunTapIp = ETHERTUNTAPIPNOTSET
u_int32_t EtherTunTapIpMask = 0xFFFFFFFF
u_int32_t EtherTunTapIpBroadcast = ETHERTUNTAPIPNOTSET
int TunTapIpOverruled = 0
int CapturePacketsOnOlsrInterfaces = 0
static char EthTapSpoofState = '1'
static char NonOlsrIfNames [MAX_NON_OLSR_IFS][IFNAMSIZ]
static int nNonOlsrIfs = 0

Define Documentation

#define ETHERTUNTAPIPNOTSET   0

Definition at line 102 of file NetworkInterfaces.c.

Referenced by CreateLocalEtherTunTap().

#define IPV4_MAX_ADDRLEN   16

Referenced by SetBmfInterfaceIp().

#define IPV4_MAX_PREFIXLEN   32

Referenced by SetBmfInterfaceIp().

#define MAX_NON_OLSR_IFS   32

Definition at line 1292 of file NetworkInterfaces.c.

Referenced by AddNonOlsrBmfIf().


Function Documentation

static void AddDescriptorToInputSet ( int  skfd  )  [static]
void AddInterface ( struct interface newIntf  ) 

Definition at line 1199 of file NetworkInterfaces.c.

Referenced by InterfaceChange().

void AddMulticastRoute ( void   ) 

Definition at line 1419 of file NetworkInterfaces.c.

References ARM_NOWARN_ALIGN, EtherTunTapIfName, LOG_PLUGINS, OLSR_WARN, and RTF_UP.

Referenced by InitBmf().

int AddNonOlsrBmfIf ( const char *  ifName,
void *data   __attribute__(unused),
set_plugin_parameter_addon addon   __attribute__(unused) 
)

Definition at line 1308 of file NetworkInterfaces.c.

References LOG_PLUGINS, MAX_NON_OLSR_IFS, and OLSR_WARN.

void CheckAndUpdateLocalBroadcast ( unsigned char *  ipPacket,
union olsr_ip_addr broadAddr 
)

Definition at line 1359 of file NetworkInterfaces.c.

References ARM_NOWARN_ALIGN, GetIpHeaderLength(), IsMulticast(), and olsr_ip_addr::v4.

Referenced by BmfEncapsulationPacketReceived(), BmfPacketCaptured(), and BmfTunPacketCaptured().

Here is the call graph for this function:

void CloseBmfNetworkInterfaces ( void   ) 

Definition at line 1227 of file NetworkInterfaces.c.

Referenced by CloseBmf(), and CloseMDNS().

int CreateBmfNetworkInterfaces ( struct interface skipThisIntf  ) 

Definition at line 1102 of file NetworkInterfaces.c.

Referenced by InitBmf(), and InitMDNS().

static int CreateCaptureSocket ( const char *  ifName  )  [static]

Definition at line 585 of file NetworkInterfaces.c.

References AddDescriptorToInputSet(), LOG_PLUGINS, and OLSR_WARN.

Referenced by CreateInterface().

Here is the call graph for this function:

static int CreateEncapsulateSocket ( const char *  ifName  )  [static]

Definition at line 729 of file NetworkInterfaces.c.

References AddDescriptorToInputSet(), BMF_ENCAP_PORT, LOG_PLUGINS, and OLSR_WARN.

Referenced by CreateInterface().

Here is the call graph for this function:

static int CreateInterface ( const char *  ifName,
struct interface olsrIntf 
) [static]
static int CreateListeningSocket ( const char *  ifName  )  [static]

Definition at line 657 of file NetworkInterfaces.c.

References AddDescriptorToInputSet(), LOG_PLUGINS, and OLSR_WARN.

Referenced by CreateInterface().

Here is the call graph for this function:

static int CreateLocalEtherTunTap ( void   )  [static]
int DeactivateSpoofFilter ( void   ) 

Definition at line 301 of file NetworkInterfaces.c.

References EtherTunTapIfName, LOG_PLUGINS, and OLSR_WARN.

Referenced by InitBmf().

void DeleteMulticastRoute ( void   ) 
void FindNeighbors ( struct TBestNeighbors neighbors,
struct link_entry **  bestNeighbor,
struct TBmfInterface intf,
union olsr_ip_addr source,
union olsr_ip_addr forwardedBy,
union olsr_ip_addr forwardedTo,
int *  nPossibleNeighbors 
)
int IsNonOlsrBmfIf ( const char *  ifName  ) 

Definition at line 1332 of file NetworkInterfaces.c.

Referenced by CreateBmfNetworkInterfaces().

void RestoreSpoofFilter ( void   ) 

Definition at line 351 of file NetworkInterfaces.c.

References EtherTunTapIfName, LOG_PLUGINS, and OLSR_WARN.

Referenced by CloseBmf().

int SetBmfInterfaceIp ( const char *  ip,
void *data   __attribute__(unused),
set_plugin_parameter_addon addon   __attribute__(unused) 
)

Definition at line 158 of file NetworkInterfaces.c.

References EtherTunTapIp, EtherTunTapIpBroadcast, EtherTunTapIpMask, inet_aton(), IPV4_MAX_ADDRLEN, IPV4_MAX_PREFIXLEN, and TunTapIpOverruled.

Here is the call graph for this function:

int SetBmfInterfaceName ( const char *  ifname,
void *data   __attribute__(unused),
set_plugin_parameter_addon addon   __attribute__(unused) 
)

Definition at line 137 of file NetworkInterfaces.c.

References EtherTunTapIfName.

int SetBmfMechanism ( const char *  mechanism,
void *data   __attribute__(unused),
set_plugin_parameter_addon addon   __attribute__(unused) 
)

Definition at line 251 of file NetworkInterfaces.c.

References BM_BROADCAST, BM_UNICAST_PROMISCUOUS, and BmfMechanism.

int SetCapturePacketsOnOlsrInterfaces ( const char *  enable,
void *data   __attribute__(unused),
set_plugin_parameter_addon addon   __attribute__(unused) 
)

Definition at line 224 of file NetworkInterfaces.c.

References CapturePacketsOnOlsrInterfaces.


Variable Documentation

struct TBmfInterface* BmfInterfaces = NULL
enum TBmfMechanism BmfMechanism = BM_BROADCAST

Definition at line 123 of file NetworkInterfaces.c.

Referenced by CreateInterface(), and SetCapturePacketsOnOlsrInterfaces().

int EtherTunTapFd = -1
char EtherTunTapIfName[IFNAMSIZ] = "bmf0"
u_int32_t EtherTunTapIp = ETHERTUNTAPIPNOTSET
u_int32_t EtherTunTapIpBroadcast = ETHERTUNTAPIPNOTSET
u_int32_t EtherTunTapIpMask = 0xFFFFFFFF

Definition at line 110 of file NetworkInterfaces.c.

Referenced by CreateLocalEtherTunTap(), and SetBmfInterfaceIp().

char EthTapSpoofState = '1' [static]

Definition at line 288 of file NetworkInterfaces.c.

int HighestSkfd = -1

Definition at line 84 of file NetworkInterfaces.c.

Referenced by AddDescriptorToInputSet(), and DoBmf().

fd_set InputSet

Definition at line 87 of file NetworkInterfaces.c.

Referenced by AddDescriptorToInputSet(), CreateBmfNetworkInterfaces(), and DoBmf().

Definition at line 80 of file NetworkInterfaces.c.

int nNonOlsrIfs = 0 [static]

Definition at line 1294 of file NetworkInterfaces.c.

char NonOlsrIfNames[MAX_NON_OLSR_IFS][IFNAMSIZ] [static]

Definition at line 1293 of file NetworkInterfaces.c.

Definition at line 118 of file NetworkInterfaces.c.

Referenced by CreateLocalEtherTunTap(), and SetBmfInterfaceIp().

Generated on Fri May 24 06:00:02 2013 for olsrd by  doxygen 1.6.3