#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/types.h>
#include <netinet/in.h>
#include <signal.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include <stdio.h>
+
#include <linux/version.h>
#include <linux/sockios.h>
+#include <linux/ppp-ioctl.h>
#ifndef aligned_u64
/* should be defined in sys/types.h */
#include <linux/types.h>
#include <linux/if_ether.h>
#include <linux/ppp_defs.h>
-#include <linux/if_ppp.h>
#include <linux/if_pppox.h>
#include <linux/if_pppol2tp.h>
#include <pppd/pppd.h>
-#include <pppd/pathnames.h>
+#include <pppd/options.h>
#include <pppd/fsm.h>
#include <pppd/lcp.h>
#include <pppd/ccp.h>
/* Hook provided to allow other plugins to handle IP up/down */
void (*pppol2tp_ip_updown_hook)(int tunnel_id, int session_id, int up) = NULL;
-static option_t pppol2tp_options[] = {
+static struct option pppol2tp_options[] = {
{ "pppol2tp", o_special, &setdevname_pppol2tp,
"FD for PPPoL2TP socket", OPT_DEVNAM | OPT_A2STRVAL,
&pppol2tp_fd_str },
if (device_got_set)
return 0;
- if (!int_option(*argv, &pppol2tp_fd))
+ if (!ppp_int_option(*argv, &pppol2tp_fd))
return 0;
if(getsockname(pppol2tp_fd, (struct sockaddr *)&s, &len) < 0) {
/* Setup option defaults. Compression options are disabled! */
- modem = 0;
+ ppp_set_modem(false);
lcp_allowoptions[0].neg_accompression = 1;
lcp_wantoptions[0].neg_accompression = 0;
}
static void send_config_pppol2tp(int mtu,
- u_int32_t asyncmap,
+ uint32_t asyncmap,
int pcomp,
int accomp)
{
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd >= 0) {
memset (&ifr, '\0', sizeof (ifr));
- strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ ppp_get_ifname(ifr.ifr_name, sizeof(ifr.ifr_name));
strlcpy(ifr.ifr_newname, pppol2tp_ifname,
sizeof(ifr.ifr_name));
ioctl(fd, SIOCSIFNAME, (caddr_t) &ifr);
- strlcpy(ifname, pppol2tp_ifname, 32);
+ ppp_set_ifname(pppol2tp_ifname);
if (pppol2tp_debug_mask & PPPOL2TP_MSG_CONTROL) {
dbglog("ppp%d: interface name %s",
- ifunit, ifname);
+ ppp_ifunit(), ppp_ifname());
}
}
close(fd);
warn("Overriding mtu %d to %d", mtu, lcp_allowoptions[0].mru);
mtu = lcp_allowoptions[0].mru;
}
- netif_set_mtu(ifunit, mtu);
+ ppp_set_mtu(ppp_ifunit(), mtu);
reorderto[0] = '\0';
if (pppol2tp_reorder_timeout > 0)
}
static void recv_config_pppol2tp(int mru,
- u_int32_t asyncmap,
+ uint32_t asyncmap,
int pcomp,
int accomp)
{
lcp_allowoptions[0].mru);
mru = lcp_allowoptions[0].mru;
}
- if ((ifunit >= 0) && ioctl(pppol2tp_fd, PPPIOCSMRU, (caddr_t) &mru) < 0)
+ if ((ppp_ifunit() >= 0) && ioctl(pppol2tp_fd, PPPIOCSMRU, (caddr_t) &mru) < 0)
error("Couldn't set PPP MRU: %m");
}
{
#if defined(__linux__)
extern int new_style_driver; /* From sys-linux.c */
- if (!ppp_available() && !new_style_driver)
+ if (!ppp_check_kernel_support() && !new_style_driver)
fatal("Kernel doesn't support ppp_generic - "
"needed for PPPoL2TP");
#else
fatal("No PPPoL2TP support on this OS");
#endif
- add_options(pppol2tp_options);
+ ppp_add_options(pppol2tp_options);
/* Hook up ip up/down notifiers to send indicator to openl2tpd
* that the link is up
*/
- add_notifier(&ip_up_notifier, pppol2tp_ip_up, NULL);
- add_notifier(&ip_down_notifier, pppol2tp_ip_down, NULL);
-#ifdef INET6
- add_notifier(&ipv6_up_notifier, pppol2tp_ip_up, NULL);
- add_notifier(&ipv6_down_notifier, pppol2tp_ip_down, NULL);
+ ppp_add_notify(NF_IP_UP, pppol2tp_ip_up, NULL);
+ ppp_add_notify(NF_IP_DOWN, pppol2tp_ip_down, NULL);
+#ifdef PPP_WITH_IPV6CP
+ ppp_add_notify(NF_IPV6_UP, pppol2tp_ip_up, NULL);
+ ppp_add_notify(NF_IPV6_DOWN, pppol2tp_ip_down, NULL);
#endif
}
.check_options = &pppol2tp_check_options,
.connect = &connect_pppol2tp,
.disconnect = &disconnect_pppol2tp,
- .establish_ppp = &generic_establish_ppp,
- .disestablish_ppp = &generic_disestablish_ppp,
+ .establish_ppp = &ppp_generic_establish,
+ .disestablish_ppp = &ppp_generic_disestablish,
.send_config = &send_config_pppol2tp,
.recv_config = &recv_config_pppol2tp,
.close = NULL,