Add DHCPv6 support with acceleration
This commit is contained in:
parent
a9e18411d3
commit
5dcbd68b75
5 changed files with 164 additions and 5 deletions
23
l2tpns.c
23
l2tpns.c
|
|
@ -1228,6 +1228,8 @@ static int create_kernel_accel(sessionidt s)
|
|||
sess_local[s].ppp_if_fd = ppp_if_fd;
|
||||
sess_local[s].ppp_if_idx = ifr.ifr_ifindex;
|
||||
|
||||
dhcpv6_listen(ifr.ifr_ifindex);
|
||||
|
||||
memset(&sess_local[s].last_stats, 0, sizeof(sess_local[s].last_stats));
|
||||
|
||||
return 0;
|
||||
|
|
@ -5447,8 +5449,8 @@ static int still_busy(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// the base set of fds polled: cli, cluster, tun, udp (MAX_UDPFD), control, dae, netlink, udplac, pppoedisc, pppoesess, kernel ppp
|
||||
#define BASE_FDS (9 + MAX_UDPFD)
|
||||
// the base set of fds polled: cli, cluster, tun, udp (MAX_UDPFD), control, dae, netlink, udplac, pppoedisc, pppoesess, dhcpv6
|
||||
#define BASE_FDS (10 + MAX_UDPFD)
|
||||
|
||||
// additional polled fds
|
||||
#ifdef BGP
|
||||
|
|
@ -5464,14 +5466,17 @@ static int still_busy(void)
|
|||
|
||||
#define MAX_FDS (BASE_FDS + RADIUS_FDS + EXTRA_FDS + L2TP_FDS + PPPOX_FDS + PPP_CHAN_FDS + PPP_IF_FDS)
|
||||
|
||||
// for the header of the forwarded MPPP/DHCP packet (see C_MPPP_FORWARD)
|
||||
#define SLACK 56
|
||||
|
||||
// main loop - gets packets on tun or udp and processes them
|
||||
static void mainloop(void)
|
||||
{
|
||||
int i, j;
|
||||
uint8_t buf[65536];
|
||||
uint8_t *p = buf + 32; // for the header of the forwarded MPPP packet (see C_MPPP_FORWARD)
|
||||
uint8_t *p = buf + SLACK; // for the header of the forwarded MPPP packet (see C_MPPP_FORWARD)
|
||||
// and the forwarded pppoe session
|
||||
int size_bufp = sizeof(buf) - 32;
|
||||
int size_bufp = sizeof(buf) - SLACK;
|
||||
clockt next_cluster_ping = 0; // send initial ping immediately
|
||||
struct epoll_event events[MAX_FDS];
|
||||
int maxevent = sizeof(events)/sizeof(*events);
|
||||
|
|
@ -5528,6 +5533,10 @@ static void mainloop(void)
|
|||
e.data.ptr = &d[i++];
|
||||
epoll_ctl(epollfd, EPOLL_CTL_ADD, pppoesessfd, &e);
|
||||
|
||||
d[i].type = FD_TYPE_DHCPV6;
|
||||
e.data.ptr = &d[i++];
|
||||
epoll_ctl(epollfd, EPOLL_CTL_ADD, dhcpv6fd, &e);
|
||||
|
||||
for (j = 0; j < config->nbudpfd; j++)
|
||||
{
|
||||
d[i].type = FD_TYPE_UDP;
|
||||
|
|
@ -5787,6 +5796,12 @@ static void mainloop(void)
|
|||
break;
|
||||
}
|
||||
|
||||
case FD_TYPE_DHCPV6:
|
||||
{
|
||||
dhcpv6_process_from_kernel(p, size_bufp);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
LOG(0, 0, 0, "Unexpected fd type returned from epoll_wait: %d\n", d->type);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue