peapod
0.1.0
EAPOL Proxy Daemon
|
Main event loop, related operations. More...
#include <signal.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/epoll.h>
#include "args.h"
#include "log.h"
#include "packet.h"
#include "process.h"
Functions | |
static void | check_signals (void) |
Check and set signal counters. More... | |
static int | create_epoll (void) |
Create an epoll instance. More... | |
static void | spurious_event (char *name, uint32_t events) |
Log an error on receiving a spurious epoll event. More... | |
void | proxy (struct iface_t *ifaces) |
Main event loop. More... | |
Variables | |
volatile sig_atomic_t | sig_hup |
volatile sig_atomic_t | sig_int |
volatile sig_atomic_t | sig_usr1 |
volatile sig_atomic_t | sig_term |
struct args_t | args |
Program arguments data structure. More... | |
Main event loop, related operations.
|
static |
Check and set signal counters.
|
static |
Create an epoll
instance.
|
static |
Log an error on receiving a spurious epoll
event.
name | The name of a network interface |
events | The events field of a struct epoll_event |
epoll(4)
void proxy | ( | struct iface_t * | ifaces | ) |
Main event loop.
The loop flow approximates the following:
packet
) on a configured interface (iface
). packet
is an Ethernet frame containing an EAPOL MPDU and iface
is a network interface configured in the config file.packet
is the first EAPOL packet to be received on iface
, and any other interfaces are configured to have their MAC address set from the source MAC address of such a packet:packet
entirely and restart the loop.iface
has an ingress script defined matching the EAPOL Packet Type or EAP Code of packet
, execute the ingress script.iface
has an ingress filter defined matching packet
, apply the ingress filter (i.e. drop packet
entirely and restart the loop).eiface
):packet
(epacket
).eiface
has a dot1q option defined, add/change/remove the 802.1Q VLAN tag in epacket
.eiface
has an egress filter defined matching epacket
, apply the egress filter. epacket
entirely on eiface
and moving on to proxying packet
on the next egress interface.eiface
has an egress script defined matching epacket
, execute the egress script.epacket
on eiface
.ifaces | Pointer to a list of struct iface_t structures representing network interfaces |
volatile sig_atomic_t sig_hup |
volatile sig_atomic_t sig_int |
volatile sig_atomic_t sig_usr1 |
volatile sig_atomic_t sig_term |
struct args_t args |
Program arguments data structure.