summaryrefslogtreecommitdiff
path: root/accel-pppd/include/connlimit.h
blob: 8711cf8b436069ed638911df290b3b0921f31c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef __CONNLIMIT_H
#define __CONNLIMIT_H

static inline uint64_t cl_key_from_ipv4(uint32_t ip)
{
	return ip;
}

static inline uint64_t cl_key_from_mac(uint8_t hw[6])
{
	union {
		uint8_t hw[6];
		uint64_t key;
	} key = {{ 0 }};

	memcpy(key.hw, hw, sizeof(key.hw));

	return key.key;
}

int connlimit_check(uint64_t key);

#endif