diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-07-05 14:08:04 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-07-05 14:08:04 +0400 |
commit | 64b5b693764c4f36870fd988ccbb53bcb188e74d (patch) | |
tree | 7af1897fdb9edd9cf40885c65f8567ae58bc0de6 /accel-pppd/session.c | |
parent | 046642d5729493b25e5fba4b11c507fe3d2e2687 (diff) | |
download | accel-ppp-64b5b693764c4f36870fd988ccbb53bcb188e74d.tar.gz accel-ppp-64b5b693764c4f36870fd988ccbb53bcb188e74d.zip |
ipoe: futher work
Diffstat (limited to 'accel-pppd/session.c')
-rw-r--r-- | accel-pppd/session.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/accel-pppd/session.c b/accel-pppd/session.c index 0064f54..886aa40 100644 --- a/accel-pppd/session.c +++ b/accel-pppd/session.c @@ -17,6 +17,7 @@ #include "log.h" #include "events.h" #include "ap_session.h" +#include "spinlock.h" #include "mempool.h" #include "memdebug.h" @@ -24,6 +25,10 @@ int conf_sid_ucase; pthread_rwlock_t __export ses_lock = PTHREAD_RWLOCK_INITIALIZER; __export LIST_HEAD(ses_list); +#if __WORDSIZE == 32 +static spinlock_t seq_lock; +#endif + int __export sock_fd; int __export sock6_fd; int __export urandom_fd; @@ -39,6 +44,7 @@ void __export ap_session_init(struct ap_session *ses) { memset(ses, 0, sizeof(*ses)); INIT_LIST_HEAD(&ses->pd_list); + ses->ifindex = -1; } int __export ap_session_starting(struct ap_session *ses) @@ -47,14 +53,16 @@ int __export ap_session_starting(struct ap_session *ses) ses->start_time = time(NULL); - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, ses->ifname); - - if (ioctl(sock_fd, SIOCGIFINDEX, &ifr)) { - log_ppp_error("ioctl(SIOCGIFINDEX): %s\n", strerror(errno)); - return -1; + if (ses->ifindex == -1) { + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, ses->ifname); + + if (ioctl(sock_fd, SIOCGIFINDEX, &ifr)) { + log_ppp_error("ioctl(SIOCGIFINDEX): %s\n", strerror(errno)); + return -1; + } + ses->ifindex = ifr.ifr_ifindex; } - ses->ifindex = ifr.ifr_ifindex; generate_sessionid(ses); |