X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/35f10d93f4f2bbd5791dc0996a36f0ba8386576d..f9243ffec5567b4ee24d349fb3866cc111e0c9a7:/l2tpns.c diff --git a/l2tpns.c b/l2tpns.c index 9dbde7a..5f3b865 100644 --- a/l2tpns.c +++ b/l2tpns.c @@ -179,6 +179,7 @@ config_descriptt config_values[] = { CONFIG("echo_timeout", echo_timeout, INT), CONFIG("idle_echo_timeout", idle_echo_timeout, INT), CONFIG("iftun_address", iftun_address, IPv4), + CONFIG("tundevicename", tundevicename, STRING), #ifdef LAC CONFIG("disable_lac_func", disable_lac_func, BOOL), CONFIG("bind_address_remotelns", bind_address_remotelns, IPv4), @@ -258,7 +259,8 @@ static clockt now(double *f) } // Time in milliseconds - time_now_ms = (t.tv_sec * 1000) + (t.tv_usec/1000); + // TODO FOR MLPPP DEV + //time_now_ms = (t.tv_sec * 1000) + (t.tv_usec/1000); return (t.tv_sec - basetime) * 10 + t.tv_usec / 100000 + 1; } @@ -689,15 +691,19 @@ static void inittun(void) int flags = fcntl(tunfd, F_GETFL, 0); fcntl(tunfd, F_SETFL, flags | O_NONBLOCK); } + + if (*config->tundevicename) + strncpy(ifr.ifr_name, config->tundevicename, IFNAMSIZ); + if (ioctl(tunfd, TUNSETIFF, (void *) &ifr) < 0) { LOG(0, 0, 0, "Can't set tun interface: %s\n", strerror(errno)); exit(1); } - assert(strlen(ifr.ifr_name) < sizeof(config->tundevice) - 1); - strncpy(config->tundevice, ifr.ifr_name, sizeof(config->tundevice)); + assert(strlen(ifr.ifr_name) < sizeof(config->tundevicename) - 1); + strncpy(config->tundevicename, ifr.ifr_name, sizeof(config->tundevicename)); - tunidx = if_nametoindex(config->tundevice); + tunidx = if_nametoindex(config->tundevicename); if (tunidx == 0) { LOG(0, 0, 0, "Can't get tun interface index\n"); @@ -3224,7 +3230,7 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr) { LOG(5, s, t, "Forwarding data session to session %u\n", session[s].forwardtosession); // Forward to LAC or Remote LNS session - lac_session_forward(buf, len, s, proto); + lac_session_forward(buf, len, s, proto, addr->sin_addr.s_addr, addr->sin_port); return; } #endif /* LAC */ @@ -5038,7 +5044,7 @@ int main(int argc, char *argv[]) exit(1); inittun(); - LOG(1, 0, 0, "Set up on interface %s\n", config->tundevice); + LOG(1, 0, 0, "Set up on interface %s\n", config->tundevicename); initudp(); initrad();