The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
base.c File Reference

Functions to send/receive ARP packets. More...

#include <freeradius-devel/util/net.h>
#include <freeradius-devel/util/struct.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/io/test_point.h>
#include "attrs.h"
#include <net/if_arp.h>
+ Include dependency graph for base.c:

Go to the source code of this file.

Data Structures

struct  fr_arp_ctx_t
 

Macros

#define COPY(_a, _b)
 

Functions

static int encode_test_ctx (void **out, TALLOC_CTX *ctx)
 
ssize_t fr_arp_decode (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *packet, size_t packet_len)
 Decode a raw ARP packet into VPs. More...
 
static ssize_t fr_arp_decode_proto (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, UNUSED void *proto_ctx)
 
ssize_t fr_arp_encode (fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_list_t *vps)
 Encode VPS into a raw ARP packet. More...
 
static ssize_t fr_arp_encode_proto (UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 
int fr_arp_entry_add (UNUSED int fd, UNUSED char const *interface, UNUSED uint8_t ipaddr[static 4], UNUSED uint8_t macaddr[static 6])
 
void fr_arp_global_free (void)
 
int fr_arp_global_init (void)
 

Variables

fr_test_point_proto_decode_t arp_tp_decode_proto
 
fr_test_point_proto_encode_t arp_tp_encode_proto
 
fr_dict_attr_t const * attr_arp_packet
 
fr_dict_t const * dict_arp
 
char const * fr_arp_packet_codes [FR_ARP_CODE_MAX]
 
static uint32_t instance_count = 0
 
fr_dict_autoload_t libfreeradius_arp_dict []
 
fr_dict_attr_autoload_t libfreeradius_arp_dict_attr []
 
fr_dict_protocol_t libfreeradius_arp_dict_protocol
 
static uint8_t const zeros [6] = { 0 }
 

Detailed Description

Functions to send/receive ARP packets.

Id
5deb6d5ea176b2ea4257e4e3bf71e0d0cb887f0a

Definition in file base.c.


Data Structure Documentation

◆ fr_arp_ctx_t

struct fr_arp_ctx_t

Definition at line 304 of file base.c.

Data Fields
bool tmp

Macro Definition Documentation

◆ COPY

#define COPY (   _a,
  _b 
)
Value:
do { \
if (memcmp(arp->_a, zeros, sizeof(arp->_a)) == 0) { \
memcpy(arp->_a, our_original->_b, sizeof(arp->_a)); \
} \
} while (0)
static uint8_t const zeros[6]
Definition: base.c:93

Function Documentation

◆ encode_test_ctx()

static int encode_test_ctx ( void **  out,
TALLOC_CTX *  ctx 
)
static

Definition at line 308 of file base.c.

+ Here is the call graph for this function:

◆ fr_arp_decode()

ssize_t fr_arp_decode ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
uint8_t const *  packet,
size_t  packet_len 
)

Decode a raw ARP packet into VPs.

Definition at line 221 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_arp_decode_proto()

static ssize_t fr_arp_decode_proto ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
uint8_t const *  data,
size_t  data_len,
UNUSED void *  proto_ctx 
)
static

Definition at line 340 of file base.c.

+ Here is the call graph for this function:

◆ fr_arp_encode()

ssize_t fr_arp_encode ( fr_dbuff_t dbuff,
uint8_t const *  original,
fr_pair_list_t vps 
)

Encode VPS into a raw ARP packet.

Definition at line 146 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_arp_encode_proto()

static ssize_t fr_arp_encode_proto ( UNUSED TALLOC_CTX *  ctx,
fr_pair_list_t vps,
uint8_t data,
size_t  data_len,
UNUSED void *  proto_ctx 
)
static

Definition at line 329 of file base.c.

+ Here is the call graph for this function:

◆ fr_arp_entry_add()

int fr_arp_entry_add ( UNUSED int  fd,
UNUSED char const *  interface,
UNUSED uint8_t  ipaddr[static 4],
UNUSED uint8_t  macaddr[static 6] 
)

Definition at line 134 of file base.c.

◆ fr_arp_global_free()

void fr_arp_global_free ( void  )

Definition at line 284 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_arp_global_init()

int fr_arp_global_init ( void  )

Definition at line 261 of file base.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ arp_tp_decode_proto

fr_test_point_proto_decode_t arp_tp_decode_proto
Initial value:
= {
.test_ctx = encode_test_ctx,
}
static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
Definition: base.c:308
static ssize_t fr_arp_decode_proto(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, UNUSED void *proto_ctx)
Definition: base.c:340

Definition at line 347 of file base.c.

◆ arp_tp_encode_proto

fr_test_point_proto_encode_t arp_tp_encode_proto
Initial value:
= {
.test_ctx = encode_test_ctx,
}
static ssize_t fr_arp_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
Definition: base.c:329

Definition at line 335 of file base.c.

◆ attr_arp_packet

fr_dict_attr_t const* attr_arp_packet

Definition at line 51 of file base.c.

◆ dict_arp

fr_dict_t const* dict_arp

Definition at line 43 of file base.c.

◆ fr_arp_packet_codes

char const* fr_arp_packet_codes[FR_ARP_CODE_MAX]
Initial value:
= {
[1] = "Request",
[2] = "Reply",
[3] = "Reverse-Request",
[4] = "Reverse-Reply",
}

Definition at line 63 of file base.c.

◆ instance_count

uint32_t instance_count = 0
static

Definition at line 41 of file base.c.

◆ libfreeradius_arp_dict

fr_dict_autoload_t libfreeradius_arp_dict
Initial value:
= {
{ .out = &dict_arp, .proto = "arp" },
{ NULL }
}
fr_dict_t const * dict_arp
Definition: base.c:43

Definition at line 46 of file base.c.

◆ libfreeradius_arp_dict_attr

fr_dict_attr_autoload_t libfreeradius_arp_dict_attr
Initial value:
= {
{ .out = &attr_arp_packet, .name = "arp", .type = FR_TYPE_STRUCT, .dict = &dict_arp },
{ NULL }
}
@ FR_TYPE_STRUCT
like TLV, but without T or L, and fixed-width children
Definition: merged_model.c:119
fr_dict_attr_t const * attr_arp_packet
Definition: base.c:51

Definition at line 54 of file base.c.

◆ libfreeradius_arp_dict_protocol

fr_dict_protocol_t libfreeradius_arp_dict_protocol
Initial value:
= {
.name = "arp",
.default_type_size = 4,
.default_type_length = 0,
}
void fr_arp_global_free(void)
Definition: base.c:284
int fr_arp_global_init(void)
Definition: base.c:261

Definition at line 294 of file base.c.

◆ zeros

uint8_t const zeros[6] = { 0 }
static

Definition at line 93 of file base.c.