summaryrefslogtreecommitdiff
path: root/accel-pptpd/ctrl
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2010-11-26 00:23:04 +0300
committerDmitry Kozlov <xeb@mail.ru>2010-11-26 00:23:04 +0300
commita8feff02a4b1a74aa5b7183ef8f8565b6ff23d08 (patch)
tree69e4e89e325c4172306576b11302563b970eca22 /accel-pptpd/ctrl
parente9e90c526a733048a3f7bf7a0138894774cb3b1a (diff)
downloadaccel-ppp-a8feff02a4b1a74aa5b7183ef8f8565b6ff23d08.tar.gz
accel-ppp-a8feff02a4b1a74aa5b7183ef8f8565b6ff23d08.zip
pppoe: check if pppoe server already started on interface add
Diffstat (limited to 'accel-pptpd/ctrl')
-rw-r--r--accel-pptpd/ctrl/pppoe/pppoe.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/accel-pptpd/ctrl/pppoe/pppoe.c b/accel-pptpd/ctrl/pppoe/pppoe.c
index b369084..daa07b7 100644
--- a/accel-pptpd/ctrl/pppoe/pppoe.c
+++ b/accel-pptpd/ctrl/pppoe/pppoe.c
@@ -878,12 +878,24 @@ static void pppoe_serv_close(struct triton_context_t *ctx)
void pppoe_server_start(const char *ifname, void *cli)
{
- struct pppoe_serv_t *serv = _malloc(sizeof(*serv));
+ struct pppoe_serv_t *serv;
int sock;
int opt = 1;
struct ifreq ifr;
struct sockaddr_ll sa;
+ pthread_rwlock_rdlock(&serv_lock);
+ list_for_each_entry(serv, &serv_list, entry) {
+ if (!strcmp(serv->ifname, ifname)) {
+ if (cli)
+ cli_send(cli, "error: already exists\r\n");
+ pthread_rwlock_unlock(&serv_lock);
+ return;
+ }
+ }
+ pthread_rwlock_unlock(&serv_lock);
+
+ serv = _malloc(sizeof(*serv));
memset(serv, 0, sizeof(*serv));
sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_PPP_DISC));