25 RCSIDH(net_h,
"$Id: 899696e4002696895ff825487cfd97a2d5fd7d67 $")
35 #include <freeradius-devel/build.h>
36 #include <freeradius-devel/ethernet/ethernet.h>
37 #include <freeradius-devel/missing.h>
38 #include <freeradius-devel/util/hash.h>
39 #include <freeradius-devel/util/misc.h>
40 #include <freeradius-devel/util/strerror.h>
41 #include <freeradius-devel/util/table.h>
43 #include <netinet/in.h>
45 #include <sys/socket.h>
64 #define ETHER_ADDR_LEN 6
74 #define ETHER_HDR_LEN 22
80 #define RADIUS_HEADER_LENGTH 20
87 #define MAX_RADIUS_LEN 4096
88 #define MIN_RADIUS_LEN 20
89 #define RADIUS_AUTH_VECTOR_LENGTH 16
92 #define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4)
93 #define IP_HL(ip) (((ip)->ip_vhl & 0x0f) << 2)
95 #define IP_VHL(v, hl) ((v & 0x0f) << 4) | (hl & 0x0f)
99 #define IP_OFFMASK 0x1fff
104 typedef struct CC_HINT(__packed__) {
115 struct in_addr ip_src, ip_dst;
118 typedef struct CC_HINT(__packed__) {
125 struct in6_addr ip_src, ip_dst;
128 typedef struct CC_HINT(__packed__) {
129 struct in6_addr ip_src, ip_dst;
138 typedef struct CC_HINT(__packed__) {
153 struct in_addr
const src_addr,
struct in_addr
const dst_addr);
size_t fr_net_af_table_len
uint32_t ip_vtcfl
Version, traffic class, flow label.
uint32_t ip_next
upper 24 bits must be zero
uint8_t ip_tos
Type of service.
uint16_t ip_len
Total length.
fr_table_num_sorted_t const fr_net_sock_type_table[]
Strings for socket types.
uint16_t ip_id
identification.
uint16_t fr_ip6_pesudo_header_checksum(struct in6_addr const *src, struct in6_addr const *dst, uint16_t ip_len, uint8_t ip_next)
fr_table_num_sorted_t const fr_net_ip_proto_table[]
Strings for L4 protocols.
uint8_t ip_ttl
Time To Live.
int fr_udp_header_check(uint8_t const *data, uint16_t remaining, ip_header_t const *ip)
Check UDP header is valid.
uint16_t fr_udp_checksum(uint8_t const *data, uint16_t len, uint16_t checksum, struct in_addr const src_addr, struct in_addr const dst_addr)
Calculate UDP checksum.
size_t fr_net_ip_proto_table_len
uint16_t ip_off
Fragment offset field.
fr_table_num_sorted_t const fr_net_af_table[]
Strings for address families.
uint16_t fr_ip_header_checksum(uint8_t const *data, uint8_t ihl)
Calculate IP header checksum.
uint16_t dst
Destination port.
size_t fr_net_sock_type_table_len
uint16_t checksum
UDP checksum.
uint16_t ip_len
Payload length.
uint8_t ip_vhl
Header length, version.
uint8_t ip_next
Next header (protocol)
An element in a lexicographically sorted array of name to num mappings.