peapod  0.1.0
EAPOL Proxy Daemon
Functions | Variables
process.c File Reference

Process an EAPOL packet. More...

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include "args.h"
#include "b64enc.h"
#include "log.h"
#include "packet.h"
#include "peapod.h"
#include "process.h"
Include dependency graph for process.c:

Functions

static void script (struct peapod_packet packet, char *script)
 Execute a script. More...
 
int process_filter (struct peapod_packet packet)
 Determine if an EAPOL packet should be filtered (dropped) More...
 
void process_script (struct peapod_packet packet)
 A wrapper for script() More...
 

Variables

struct args_t args
 Program arguments data structure. More...
 
char ** environ
 
uint8_t * mpdu_buf
 The EAPOL MPDU. More...
 
int mpdu_buf_size
 Normally 1502 bytes. More...
 

Detailed Description

Process an EAPOL packet.

Function Documentation

static void script ( struct peapod_packet  packet,
char *  script 
)
static

Execute a script.

The script is run with several environment variables set containing at least the entire Base64-encoded Ethernet frame encapsulating an EAPOL packet at the time of capture on an ingress interface, the entire frame that is being sent (if applicable) on an egress interface (which may differ from the original in its 802.1Q tag), and associated metadata extracted from packet.

Parameters
packetA struct peapod_packet representing an EAPOL packet
scriptPath of the script to be executed
See also
The env.sh example script for a listing of the possible environment variables and their values
int process_filter ( struct peapod_packet  packet)

Determine if an EAPOL packet should be filtered (dropped)

packet should contain enough information to determine whether an ingress or egress filter should be applied.

Parameters
packetA struct peapod_packet representing an EAPOL packet
Returns
1 if the EAPOL packet should be filtered, or 0 if not
void process_script ( struct peapod_packet  packet)

A wrapper for script()

packet should contain enough information to determine whether an ingress or egress script should be executed, upon which script() is called with the appropriate parameters extracted from packet.

Parameters
packetA struct peapod_packet representing an EAPOL packet

Variable Documentation

struct args_t args

Program arguments data structure.

Note
Global
char** environ
uint8_t* mpdu_buf

The EAPOL MPDU.

Points to byte 16 of the main EAPOL packet buffer, and thereby to the EAPOL EtherType (0x888e) followed by the MTU (normally up to 1500 bytes).

Note
Global
int mpdu_buf_size

Normally 1502 bytes.

Note
Global