summaryrefslogtreecommitdiff
path: root/accel-pptpd
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd')
-rw-r--r--accel-pptpd/accel-pptp.conf.55
-rw-r--r--accel-pptpd/auth/auth_chap_md5.c30
-rw-r--r--accel-pptpd/auth/auth_mschap_v1.c30
-rw-r--r--accel-pptpd/auth/auth_mschap_v2.c30
-rw-r--r--accel-pptpd/auth/auth_pap.c10
-rw-r--r--accel-pptpd/cli/tcp.c2
-rw-r--r--accel-pptpd/cli/telnet.c2
-rw-r--r--accel-pptpd/ctrl/l2tp/l2tp.c15
-rw-r--r--accel-pptpd/ctrl/pppoe/pppoe.c71
-rw-r--r--accel-pptpd/ctrl/pptp/pptp.c33
-rw-r--r--accel-pptpd/extra/pppd_compat.c16
-rw-r--r--accel-pptpd/extra/shaper_tbf.c8
-rw-r--r--accel-pptpd/log.c32
-rw-r--r--accel-pptpd/log.h11
-rw-r--r--accel-pptpd/logs/log_file.c4
-rw-r--r--accel-pptpd/logs/log_tcp.c2
-rw-r--r--accel-pptpd/main.c2
-rw-r--r--accel-pptpd/ppp/ppp.c3
-rw-r--r--accel-pptpd/ppp/ppp_auth.c7
-rw-r--r--accel-pptpd/ppp/ppp_auth.h2
-rw-r--r--accel-pptpd/ppp/ppp_ccp.c78
-rw-r--r--accel-pptpd/ppp/ppp_ipcp.c78
-rw-r--r--accel-pptpd/ppp/ppp_lcp.c92
-rw-r--r--accel-pptpd/radius/acct.c4
-rw-r--r--accel-pptpd/radius/dm_coa.c16
-rw-r--r--accel-pptpd/radius/req.c8
26 files changed, 309 insertions, 282 deletions
diff --git a/accel-pptpd/accel-pptp.conf.5 b/accel-pptpd/accel-pptp.conf.5
index 669d503..c0e257b 100644
--- a/accel-pptpd/accel-pptp.conf.5
+++ b/accel-pptpd/accel-pptp.conf.5
@@ -293,9 +293,12 @@ log only error messages
log error and warning messages
.br
.B 3
-log error, warning and information messages (use this level in conjuction with verbose option of other modules if you need verbose logging)
+log error, warning and minimum information messages (use this level in conjuction with verbose option of other modules if you need verbose logging)
.br
.B 4
+log error, warning and full information messages (use this level in conjuction with verbose option of other modules if you need verbose logging)
+.br
+.B 5
log all messages including debug messages
.TP
.SH [log-pgsql]
diff --git a/accel-pptpd/auth/auth_chap_md5.c b/accel-pptpd/auth/auth_chap_md5.c
index 634fba2..d19634a 100644
--- a/accel-pptpd/auth/auth_chap_md5.c
+++ b/accel-pptpd/auth/auth_chap_md5.c
@@ -89,13 +89,13 @@ static void print_buf(const uint8_t *buf, int size)
{
int i;
for (i=0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -166,7 +166,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -204,7 +204,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -220,7 +220,7 @@ static void chap_send_success(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
+ log_ppp_info2("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -239,9 +239,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [CHAP Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [CHAP Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -263,11 +263,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [CHAP Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [CHAP Response id=%x <", msg->hdr.id);
print_buf(msg->val, msg->val_size);
- log_ppp_info(">, name=\"");
+ log_ppp_info2(">, name=\"");
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -319,9 +319,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
- }else
- {
+ ppp_auth_failed(ad->ppp, name);
+ _free(name);
+ } else {
chap_send_success(ad);
if (!ad->started) {
ad->started = 1;
@@ -334,11 +334,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
_free(passwd);
} else if (r == PWDB_DENIED) {
chap_send_failure(ad);
- _free(name);
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
+ _free(name);
} else {
chap_send_success(ad);
if (!ad->started) {
diff --git a/accel-pptpd/auth/auth_mschap_v1.c b/accel-pptpd/auth/auth_mschap_v1.c
index 280a672..5b38db5 100644
--- a/accel-pptpd/auth/auth_mschap_v1.c
+++ b/accel-pptpd/auth/auth_mschap_v1.c
@@ -106,13 +106,13 @@ static void print_buf(const uint8_t *buf,int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for(i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -183,7 +183,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -221,7 +221,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v1 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [MSCHAP-v1 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp,&msg,ntohs(msg.hdr.len)+2);
}
@@ -237,7 +237,7 @@ static void chap_send_success(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v1 Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
+ log_ppp_info2("send [MSCHAP-v1 Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -256,9 +256,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [MSCHAP-v1 Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [MSCHAP-v1 Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -277,13 +277,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [MSCHAP-v1 Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [MSCHAP-v1 Response id=%x <", msg->hdr.id);
print_buf(msg->lm_hash, 24);
- log_ppp_info(">, <");
+ log_ppp_info2(">, <");
print_buf(msg->nt_hash, 24);
- log_ppp_info(">, F=%i, name=\"", msg->flags);
+ log_ppp_info2(">, F=%i, name=\"", msg->flags);
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -293,7 +293,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
if (msg->val_size != RESPONSE_VALUE_SIZE) {
@@ -302,7 +302,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
name = _strndup(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
@@ -311,7 +311,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
return;
}
@@ -332,7 +332,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
_free(name);
} else {
chap_send_success(ad);
diff --git a/accel-pptpd/auth/auth_mschap_v2.c b/accel-pptpd/auth/auth_mschap_v2.c
index 374c152..014c696 100644
--- a/accel-pptpd/auth/auth_mschap_v2.c
+++ b/accel-pptpd/auth/auth_mschap_v2.c
@@ -106,14 +106,14 @@ static void print_buf(const uint8_t *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%x", buf[i]);
+ log_ppp_info2("%x", buf[i]);
}
static void print_str(const char *buf, int size)
{
int i;
for (i = 0; i < size; i++)
- log_ppp_info("%c", buf[i]);
+ log_ppp_info2("%c", buf[i]);
}
static struct auth_data_t* auth_data_init(struct ppp_t *ppp)
@@ -184,7 +184,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
if (d->started)
ppp_terminate(d->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
} else {
--d->id;
chap_send_challenge(d);
@@ -222,7 +222,7 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
};
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
+ log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -310,7 +310,7 @@ static void chap_send_success(struct chap_auth_data_t *ad, struct chap_response_
memcpy(msg.message + 2, authenticator, 40);
if (conf_ppp_verbose)
- log_ppp_info("send [MSCHAP-v2 Success id=%x \"%s\"]\n", msg.hdr.id, msg.message);
+ log_ppp_info2("send [MSCHAP-v2 Success id=%x \"%s\"]\n", msg.hdr.id, msg.message);
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
}
@@ -329,9 +329,9 @@ static void chap_send_challenge(struct chap_auth_data_t *ad)
memcpy(msg.val, ad->val, VALUE_SIZE);
if (conf_ppp_verbose) {
- log_ppp_info("send [MSCHAP-v2 Challenge id=%x <", msg.hdr.id);
+ log_ppp_info2("send [MSCHAP-v2 Challenge id=%x <", msg.hdr.id);
print_buf(msg.val, VALUE_SIZE);
- log_ppp_info(">]\n");
+ log_ppp_info2(">]\n");
}
ppp_chan_send(ad->ppp, &msg, ntohs(msg.hdr.len) + 2);
@@ -351,13 +351,13 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
triton_timer_del(&ad->timeout);
if (conf_ppp_verbose) {
- log_ppp_info("recv [MSCHAP-v2 Response id=%x <", msg->hdr.id);
+ log_ppp_info2("recv [MSCHAP-v2 Response id=%x <", msg->hdr.id);
print_buf(msg->peer_challenge,16);
- log_ppp_info(">, <");
+ log_ppp_info2(">, <");
print_buf(msg->nt_hash, 24);
- log_ppp_info(">, F=%i, name=\"", msg->flags);
+ log_ppp_info2(">, F=%i, name=\"", msg->flags);
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
- log_ppp_info("\"]\n");
+ log_ppp_info2("\"]\n");
}
if (msg->hdr.id != ad->id) {
@@ -367,7 +367,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
if (msg->val_size != RESPONSE_VALUE_SIZE) {
@@ -376,7 +376,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_USER_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
}
name = _strndup(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
@@ -385,7 +385,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_NAS_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, NULL);
return;
}
@@ -404,7 +404,7 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
if (ad->started)
ppp_terminate(ad->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(ad->ppp);
+ ppp_auth_failed(ad->ppp, name);
_free(name);
} else {
chap_send_success(ad, msg, authenticator);
diff --git a/accel-pptpd/auth/auth_pap.c b/accel-pptpd/auth/auth_pap.c
index 27b4dd8..6909046 100644
--- a/accel-pptpd/auth/auth_pap.c
+++ b/accel-pptpd/auth/auth_pap.c
@@ -119,7 +119,7 @@ static void pap_timeout(struct triton_timer_t *t)
if (conf_ppp_verbose)
log_ppp_warn("pap: timeout\n");
- ppp_auth_failed(d->ppp);
+ ppp_auth_failed(d->ppp, NULL);
}
static int lcp_send_conf_req(struct ppp_t *ppp, struct auth_data_t *d, uint8_t *ptr)
@@ -144,7 +144,7 @@ static void pap_send_ack(struct pap_auth_data_t *p, int id)
memcpy(msg->msg, MSG_SUCCESSED, sizeof(MSG_SUCCESSED));
if (conf_ppp_verbose)
- log_ppp_info("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED);
+ log_ppp_info2("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED);
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -161,7 +161,7 @@ static void pap_send_nak(struct pap_auth_data_t *p, int id)
memcpy(msg->msg, MSG_FAILED, sizeof(MSG_FAILED));
if (conf_ppp_verbose)
- log_ppp_info("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED);
+ log_ppp_info2("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED);
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -180,7 +180,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
triton_timer_del(&p->timeout);
if (conf_ppp_verbose)
- log_ppp_info("recv [PAP AuthReq id=%x]\n", hdr->id);
+ log_ppp_info2("recv [PAP AuthReq id=%x]\n", hdr->id);
peer_id_len = *(uint8_t*)ptr; ptr++;
if (peer_id_len > ntohs(hdr->len) - sizeof(*hdr) + 2 - 1) {
@@ -222,7 +222,7 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
if (p->started)
ppp_terminate(p->ppp, TERM_AUTH_ERROR, 0);
else
- ppp_auth_failed(p->ppp);
+ ppp_auth_failed(p->ppp, peer_id);
ret=-1;
_free(peer_id);
} else {
diff --git a/accel-pptpd/cli/tcp.c b/accel-pptpd/cli/tcp.c
index f6d2011..405c389 100644
--- a/accel-pptpd/cli/tcp.c
+++ b/accel-pptpd/cli/tcp.c
@@ -236,7 +236,7 @@ static int serv_read(struct triton_md_handler_t *h)
continue;
}
- log_info("cli: tcp: new connection from %s\n", inet_ntoa(addr.sin_addr));
+ log_info2("cli: tcp: new connection from %s\n", inet_ntoa(addr.sin_addr));
if (fcntl(sock, F_SETFL, O_NONBLOCK)) {
log_error("cli: tcp: failed to set nonblocking mode: %s, closing connection...\n", strerror(errno));
diff --git a/accel-pptpd/cli/telnet.c b/accel-pptpd/cli/telnet.c
index c7a3c7a..a4cee6b 100644
--- a/accel-pptpd/cli/telnet.c
+++ b/accel-pptpd/cli/telnet.c
@@ -510,7 +510,7 @@ static int serv_read(struct triton_md_handler_t *h)
continue;
}
- log_info("cli: telnet: new connection from %s\n", inet_ntoa(addr.sin_addr));
+ log_info2("cli: telnet: new connection from %s\n", inet_ntoa(addr.sin_addr));
if (fcntl(sock, F_SETFL, O_NONBLOCK)) {
log_error("cli: telnet: failed to set nonblocking mode: %s, closing connection...\n", strerror(errno));
diff --git a/accel-pptpd/ctrl/l2tp/l2tp.c b/accel-pptpd/ctrl/l2tp/l2tp.c
index bcd9a18..2314748 100644
--- a/accel-pptpd/ctrl/l2tp/l2tp.c
+++ b/accel-pptpd/ctrl/l2tp/l2tp.c
@@ -137,8 +137,7 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn)
triton_event_fire(EV_CTRL_FINISHED, &conn->ppp);
- if (conf_verbose)
- log_ppp_info("disconnected\n");
+ log_ppp_info1("disconnected\n");
triton_context_unregister(&conn->ctx);
@@ -351,8 +350,8 @@ static int l2tp_tunnel_alloc(struct l2tp_serv_t *serv, struct l2tp_packet_t *pac
if (conf_verbose) {
log_switch(&conn->ctx, &conn->ppp);
- log_ppp_info("recv ");
- l2tp_packet_print(pack, log_ppp_info);
+ log_ppp_info2("recv ");
+ l2tp_packet_print(pack, log_ppp_info2);
}
triton_context_call(&conn->ctx, (triton_event_func)l2tp_send_SCCRP, conn);
@@ -472,8 +471,8 @@ static int l2tp_send(struct l2tp_conn_t *conn, struct l2tp_packet_t *pack, int l
log_ppp_debug("send ");
l2tp_packet_print(pack, log_ppp_debug);
} else {
- log_ppp_info("send ");
- l2tp_packet_print(pack, log_ppp_info);
+ log_ppp_info2("send ");
+ l2tp_packet_print(pack, log_ppp_info2);
}
}
@@ -917,8 +916,8 @@ static int l2tp_conn_read(struct triton_md_handler_t *h)
log_ppp_debug("recv ");
l2tp_packet_print(pack, log_ppp_debug);
} else {
- log_ppp_info("recv ");
- l2tp_packet_print(pack, log_ppp_info);
+ log_ppp_info2("recv ");
+ l2tp_packet_print(pack, log_ppp_info2);
}
}
diff --git a/accel-pptpd/ctrl/pppoe/pppoe.c b/accel-pptpd/ctrl/pppoe/pppoe.c
index 24d2405..d75df43 100644
--- a/accel-pptpd/ctrl/pppoe/pppoe.c
+++ b/accel-pptpd/ctrl/pppoe/pppoe.c
@@ -94,8 +94,7 @@ static void disconnect(struct pppoe_conn_t *conn)
triton_event_fire(EV_CTRL_FINISHED, &conn->ppp);
- if (conf_verbose)
- log_ppp_info("disconnected\n");
+ log_ppp_info1("disconnected\n");
pthread_mutex_lock(&conn->serv->lock);
conn->serv->conn[conn->sid] = NULL;
@@ -279,7 +278,7 @@ static void print_tag_string(struct pppoe_tag *tag)
int i;
for (i = 0; i < ntohs(tag->tag_len); i++)
- log_info("%c", tag->tag_data[i]);
+ log_info2("%c", tag->tag_data[i]);
}
static void print_tag_octets(struct pppoe_tag *tag)
@@ -287,7 +286,7 @@ static void print_tag_octets(struct pppoe_tag *tag)
int i;
for (i = 0; i < ntohs(tag->tag_len); i++)
- log_info("%02x", (uint8_t)tag->tag_data[i]);
+ log_info2("%02x", (uint8_t)tag->tag_data[i]);
}
static void print_packet(uint8_t *pack)
@@ -297,82 +296,82 @@ static void print_packet(uint8_t *pack)
struct pppoe_tag *tag;
int n;
- log_info("[PPPoE ");
+ log_info2("[PPPoE ");
switch (hdr->code) {
case CODE_PADI:
- log_info("PADI");
+ log_info2("PADI");
break;
case CODE_PADO:
- log_info("PADO");
+ log_info2("PADO");
break;
case CODE_PADR:
- log_info("PADR");
+ log_info2("PADR");
break;
case CODE_PADS:
- log_info("PADS");
+ log_info2("PADS");
break;
case CODE_PADT:
- log_info("PADT");
+ log_info2("PADT");
break;
}
- log_info(" %02x:%02x:%02x:%02x:%02x:%02x => %02x:%02x:%02x:%02x:%02x:%02x",
+ log_info2(" %02x:%02x:%02x:%02x:%02x:%02x => %02x:%02x:%02x:%02x:%02x:%02x",
ethhdr->h_source[0], ethhdr->h_source[1], ethhdr->h_source[2], ethhdr->h_source[3], ethhdr->h_source[4], ethhdr->h_source[5],
ethhdr->h_dest[0], ethhdr->h_dest[1], ethhdr->h_dest[2], ethhdr->h_dest[3], ethhdr->h_dest[4], ethhdr->h_dest[5]);
- log_info(" sid=%04x", ntohs(hdr->sid));
+ log_info2(" sid=%04x", ntohs(hdr->sid));
for (n = 0; n < ntohs(hdr->length); n += sizeof(*tag) + ntohs(tag->tag_len)) {
tag = (struct pppoe_tag *)(pack + ETH_HLEN + sizeof(*hdr) + n);
switch (ntohs(tag->tag_type)) {
case TAG_END_OF_LIST:
- log_info(" <End-Of-List>");
+ log_info2(" <End-Of-List>");
break;
case TAG_SERVICE_NAME:
- log_info(" <Service-Name ");
+ log_info2(" <Service-Name ");
print_tag_string(tag);
- log_info(">");
+ log_info2(">");
break;
case TAG_AC_NAME:
- log_info(" <AC-Name ");
+ log_info2(" <AC-Name ");
print_tag_string(tag);
- log_info(">");
+ log_info2(">");
break;
case TAG_HOST_UNIQ:
- log_info(" <Host-Uniq ");
+ log_info2(" <Host-Uniq ");
print_tag_octets(tag);
- log_info(">");
+ log_info2(">");
break;
case TAG_AC_COOKIE:
- log_info(" <AC-Cookie ");
+ log_info2(" <AC-Cookie ");
print_tag_octets(tag);
- log_info(">");
+ log_info2(">");
break;
case TAG_VENDOR_SPECIFIC:
- log_info(" <Vendor-Specific>");
+ log_info2(" <Vendor-Specific>");
break;
case TAG_RELAY_SESSION_ID:
- log_info(" <Relay-Session-Id");
+ log_info2(" <Relay-Session-Id");
print_tag_octets(tag);
- log_info(">");
+ log_info2(">");
break;
case TAG_SERVICE_NAME_ERROR:
- log_info(" <Service-Name-Error>");
+ log_info2(" <Service-Name-Error>");
break;
case TAG_AC_SYSTEM_ERROR:
- log_info(" <AC-System-Error>");
+ log_info2(" <AC-System-Error>");
break;
case TAG_GENERIC_ERROR:
- log_info(" <Generic-Error>");
+ log_info2(" <Generic-Error>");
break;
default:
- log_info(" <Unknown (%x)>", ntohs(tag->tag_type));
+ log_info2(" <Unknown (%x)>", ntohs(tag->tag_type));
break;
}
}
- log_info("]\n");
+ log_info2("]\n");
}
static void generate_cookie(const uint8_t *src, const uint8_t *dst, uint8_t *cookie)
@@ -464,7 +463,7 @@ static void pppoe_send_PADO(struct pppoe_serv_t *serv, const uint8_t *addr, cons
add_tag2(pack, relay_sid);
if (conf_verbose) {
- log_info("send ");
+ log_info2("send ");
print_packet(pack);
}
@@ -487,7 +486,7 @@ static void pppoe_send_err(struct pppoe_serv_t *serv, const uint8_t *addr, const
add_tag2(pack, relay_sid);
if (conf_verbose) {
- log_info("send ");
+ log_info2("send ");
print_packet(pack);
}
@@ -511,7 +510,7 @@ static void pppoe_send_PADS(struct pppoe_conn_t *conn)
add_tag2(pack, conn->relay_sid);
if (conf_verbose) {
- log_info("send ");
+ log_info2("send ");
print_packet(pack);
}
@@ -535,7 +534,7 @@ static void pppoe_send_PADT(struct pppoe_conn_t *conn)
add_tag2(pack, conn->relay_sid);
if (conf_verbose) {
- log_info("send ");
+ log_info2("send ");
print_packet(pack);
}
@@ -585,7 +584,7 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size)
}
if (conf_verbose) {
- log_info("recv ");
+ log_info2("recv ");
print_packet(pack);
}
@@ -686,7 +685,7 @@ static void pppoe_recv_PADR(struct pppoe_serv_t *serv, uint8_t *pack, int size)
}
if (conf_verbose) {
- log_info("recv ");
+ log_info2("recv ");
print_packet(pack);
}
@@ -775,7 +774,7 @@ static void pppoe_recv_PADT(struct pppoe_serv_t *serv, uint8_t *pack)
}
if (conf_verbose) {
- log_info("recv ");
+ log_info2("recv ");
print_packet(pack);
}
diff --git a/accel-pptpd/ctrl/pptp/pptp.c b/accel-pptpd/ctrl/pptp/pptp.c
index 1523d99..8a1cbbe 100644
--- a/accel-pptpd/ctrl/pptp/pptp.c
+++ b/accel-pptpd/ctrl/pptp/pptp.c
@@ -90,8 +90,7 @@ static void disconnect(struct pptp_conn_t *conn)
triton_event_fire(EV_CTRL_FINISHED, &conn->ppp);
- if (conf_verbose)
- log_ppp_info("disconnected\n");
+ log_ppp_info1("disconnected\n");
triton_context_unregister(&conn->ctx);
@@ -120,7 +119,7 @@ static int post_msg(struct pptp_conn_t *conn, void *buf, int size)
else {
if (errno != EPIPE) {
if (conf_verbose)
- log_ppp_info("pptp: write: %s\n", strerror(errno));
+ log_ppp_info2("pptp: write: %s\n", strerror(errno));
return -1;
}
}
@@ -142,7 +141,7 @@ static int send_pptp_stop_ctrl_conn_rqst(struct pptp_conn_t *conn, int reason)
};
if (conf_verbose)
- log_ppp_info("send [PPTP Stop-Ctrl-Conn-Request <Reason %i>]\n", reason);
+ log_ppp_info2("send [PPTP Stop-Ctrl-Conn-Request <Reason %i>]\n", reason);
return post_msg(conn, &msg, sizeof(msg));
}
@@ -156,7 +155,7 @@ static int send_pptp_stop_ctrl_conn_rply(struct pptp_conn_t *conn, int reason, i
};
if (conf_verbose)
- log_ppp_info("send [PPTP Stop-Ctrl-Conn-Reply <Result %i> <Error %i>]\n", msg.reason_result, msg.error_code);
+ log_ppp_info2("send [PPTP Stop-Ctrl-Conn-Reply <Result %i> <Error %i>]\n", msg.reason_result, msg.error_code);
return post_msg(conn, &msg, sizeof(msg));
}
@@ -164,7 +163,7 @@ static int pptp_stop_ctrl_conn_rqst(struct pptp_conn_t *conn)
{
struct pptp_stop_ctrl_conn *msg = (struct pptp_stop_ctrl_conn *)conn->in_buf;
if (conf_verbose)
- log_ppp_info("recv [PPTP Stop-Ctrl-Conn-Request <Reason %i>]\n", msg->reason_result);
+ log_ppp_info2("recv [PPTP Stop-Ctrl-Conn-Request <Reason %i>]\n", msg->reason_result);
send_pptp_stop_ctrl_conn_rply(conn, PPTP_CONN_STOP_OK, 0);
@@ -175,7 +174,7 @@ static int pptp_stop_ctrl_conn_rply(struct pptp_conn_t *conn)
{
struct pptp_stop_ctrl_conn *msg = (struct pptp_stop_ctrl_conn*)conn->in_buf;
if (conf_verbose)
- log_ppp_info("recv [PPTP Stop-Ctrl-Conn-Reply <Result %i> <Error %i>]\n", msg->reason_result, msg->error_code);
+ log_ppp_info2("recv [PPTP Stop-Ctrl-Conn-Reply <Result %i> <Error %i>]\n", msg->reason_result, msg->error_code);
return -1;
}
@@ -199,7 +198,7 @@ static int send_pptp_start_ctrl_conn_rply(struct pptp_conn_t *conn, int res_code
strcpy((char*)msg.vendor, PPTP_VENDOR);
if (conf_verbose)
- log_ppp_info("send [PPTP Start-Ctrl-Conn-Reply <Version %i> <Result %i> <Error %i> <Framing %x> <Bearer %x> <Max-Chan %i>]\n", msg.version, msg.result_code, msg.error_code, ntohl(msg.framing_cap), ntohl(msg.bearer_cap), ntohs(msg.max_channels));
+ log_ppp_info2("send [PPTP Start-Ctrl-Conn-Reply <Version %i> <Result %i> <Error %i> <Framing %x> <Bearer %x> <Max-Chan %i>]\n", msg.version, msg.result_code, msg.error_code, ntohl(msg.framing_cap), ntohl(msg.bearer_cap), ntohs(msg.max_channels));
return post_msg(conn, &msg, sizeof(msg));
}
@@ -209,7 +208,7 @@ static int pptp_start_ctrl_conn_rqst(struct pptp_conn_t *conn)
struct pptp_start_ctrl_conn *msg = (struct pptp_start_ctrl_conn *)conn->in_buf;
if (conf_verbose)
- log_ppp_info("recv [PPTP Start-Ctrl-Conn-Request <Version %i> <Framing %x> <Bearer %x> <Max-Chan %i>]\n", msg->version, ntohl(msg->framing_cap), ntohl(msg->bearer_cap), ntohs(msg->max_channels));
+ log_ppp_info2("recv [PPTP Start-Ctrl-Conn-Request <Version %i> <Framing %x> <Bearer %x> <Max-Chan %i>]\n", msg->version, ntohl(msg->framing_cap), ntohl(msg->bearer_cap), ntohs(msg->max_channels));
if (conn->state != STATE_IDLE) {
log_ppp_warn("unexpected PPTP_START_CTRL_CONN_RQST\n");
@@ -256,7 +255,7 @@ static int send_pptp_out_call_rply(struct pptp_conn_t *conn, struct pptp_out_cal
};
if (conf_verbose)
- log_ppp_info("send [PPTP Outgoing-Call-Reply <Call-ID %x> <Peer-Call-ID %x> <Result %i> <Error %i> <Cause %i> <Speed %i> <Window-Size %i> <Delay %i> <Channel %x>]\n", ntohs(msg.call_id), ntohs(msg.call_id_peer), msg.result_code, msg.error_code, ntohs(msg.cause_code), ntohl(msg.speed), ntohs(msg.recv_size), ntohs(msg.delay), ntohl(msg.channel));
+ log_ppp_info2("send [PPTP Outgoing-Call-Reply <Call-ID %x> <Peer-Call-ID %x> <Result %i> <Error %i> <Cause %i> <Speed %i> <Window-Size %i> <Delay %i> <Channel %x>]\n", ntohs(msg.call_id), ntohs(msg.call_id_peer), msg.result_code, msg.error_code, ntohs(msg.cause_code), ntohl(msg.speed), ntohs(msg.recv_size), ntohs(msg.delay), ntohl(msg.channel));
return post_msg(conn, &msg, sizeof(msg));
}
@@ -270,7 +269,7 @@ static int pptp_out_call_rqst(struct pptp_conn_t *conn)
int pptp_sock;
if (conf_verbose)
- log_ppp_info("recv [PPTP Outgoing-Call-Request <Call-ID %x> <Call-Serial %x> <Min-BPS %i> <Max-BPS %i> <Bearer %x> <Framing %x> <Window-Size %i> <Delay %i>]\n", ntohs(msg->call_id), ntohs(msg->call_sernum), ntohl(msg->bps_min), ntohl(msg->bps_max), ntohl(msg->bearer), ntohl(msg->framing), ntohs(msg->recv_size), ntohs(msg->delay));
+ log_ppp_info2("recv [PPTP Outgoing-Call-Request <Call-ID %x> <Call-Serial %x> <Min-BPS %i> <Max-BPS %i> <Bearer %x> <Framing %x> <Window-Size %i> <Delay %i>]\n", ntohs(msg->call_id), ntohs(msg->call_sernum), ntohl(msg->bps_min), ntohl(msg->bps_max), ntohl(msg->bearer), ntohl(msg->framing), ntohs(msg->recv_size), ntohs(msg->delay));
if (conn->state != STATE_ESTB) {
log_ppp_warn("unexpected PPTP_OUT_CALL_RQST\n");
@@ -354,7 +353,7 @@ static int send_pptp_call_disconnect_notify(struct pptp_conn_t *conn, int result
};
if (conf_verbose)
- log_ppp_info("send [PPTP Call-Disconnect-Notify <Call-ID %x> <Result %i> <Error %i> <Cause %i>]\n", ntohs(msg.call_id), msg.result_code, msg.error_code, msg.cause_code);
+ log_ppp_info2("send [PPTP Call-Disconnect-Notify <Call-ID %x> <Result %i> <Error %i> <Cause %i>]\n", ntohs(msg.call_id), msg.result_code, msg.error_code, msg.cause_code);
return post_msg(conn, &msg, sizeof(msg));
}
@@ -364,7 +363,7 @@ static int pptp_call_clear_rqst(struct pptp_conn_t *conn)
struct pptp_call_clear_rqst *rqst = (struct pptp_call_clear_rqst *)conn->in_buf;
if (conf_verbose)
- log_ppp_info("recv [PPTP Call-Clear-Request <Call-ID %x>]\n", ntohs(rqst->call_id));
+ log_ppp_info2("recv [PPTP Call-Clear-Request <Call-ID %x>]\n", ntohs(rqst->call_id));
if (conn->state == STATE_PPP) {
__sync_sub_and_fetch(&stat_active, 1);
@@ -450,7 +449,7 @@ static int process_packet(struct pptp_conn_t *conn)
return pptp_call_clear_rqst(conn);
case PPTP_SET_LINK_INFO:
if (conf_verbose)
- log_ppp_info("recv [PPTP Set-Link-Info]\n");
+ log_ppp_info2("recv [PPTP Set-Link-Info]\n");
return 0;
default:
log_ppp_warn("recv [PPTP Unknown (%x)]\n", ntohs(hdr->ctrl_type));
@@ -476,7 +475,7 @@ static int pptp_read(struct triton_md_handler_t *h)
}
if (n == 0) {
if (conf_verbose)
- log_ppp_info("pptp: disconnect by peer\n");
+ log_ppp_info2("pptp: disconnect by peer\n");
goto drop;
}
conn->in_size += n;
@@ -524,7 +523,7 @@ static int pptp_write(struct triton_md_handler_t *h)
else {
if (errno != EPIPE) {
if (conf_verbose)
- log_ppp_info("pptp: post_msg: %s\n", strerror(errno));
+ log_ppp_info2("pptp: post_msg: %s\n", strerror(errno));
}
disconnect(conn);
return 1;
@@ -618,7 +617,7 @@ static int pptp_connect(struct triton_md_handler_t *h)
continue;
}
- log_info("pptp: new connection from %s\n", inet_ntoa(addr.sin_addr));
+ log_info2("pptp: new connection from %s\n", inet_ntoa(addr.sin_addr));
if (iprange_client_check(addr.sin_addr.s_addr)) {
log_warn("pptp: IP is out of client-ip-range, droping connection...\n");
diff --git a/accel-pptpd/extra/pppd_compat.c b/accel-pptpd/extra/pppd_compat.c
index d50c929..97a89d0 100644
--- a/accel-pptpd/extra/pppd_compat.c
+++ b/accel-pptpd/extra/pppd_compat.c
@@ -63,7 +63,7 @@ static void ip_pre_up_handler(struct sigchld_handler_t *h, int status)
struct pppd_compat_pd_t *pd = container_of(h, typeof(*pd), ip_pre_up_hnd);
if (conf_verbose) {
log_switch(NULL, pd->ppp);
- log_ppp_info("pppd_compat: ip-pre-up finished (%i)\n", status);
+ log_ppp_info2("pppd_compat: ip-pre-up finished (%i)\n", status);
pd->res = status;
}
sched_yield();
@@ -75,7 +75,7 @@ static void ip_up_handler(struct sigchld_handler_t *h, int status)
struct pppd_compat_pd_t *pd = container_of(h, typeof(*pd), ip_up_hnd);
if (conf_verbose) {
log_switch(NULL, pd->ppp);
- log_ppp_info("pppd_compat: ip-up finished (%i)\n", status);
+ log_ppp_info2("pppd_compat: ip-up finished (%i)\n", status);
}
}
@@ -84,7 +84,7 @@ static void ip_down_handler(struct sigchld_handler_t *h, int status)
struct pppd_compat_pd_t *pd = container_of(h, typeof(*pd), ip_down_hnd);
if (conf_verbose) {
log_switch(NULL, pd->ppp);
- log_ppp_info("pppd_compat: ip-down finished (%i)\n", status);
+ log_ppp_info2("pppd_compat: ip-down finished (%i)\n", status);
}
sched_yield();
triton_context_wakeup(pd->ppp->ctrl->ctx);
@@ -95,7 +95,7 @@ static void ip_change_handler(struct sigchld_handler_t *h, int status)
struct pppd_compat_pd_t *pd = container_of(h, typeof(*pd), ip_change_hnd);
if (conf_verbose) {
log_switch(NULL, pd->ppp);
- log_ppp_info("pppd_compat: ip-change finished (%i)\n", status);
+ log_ppp_info2("pppd_compat: ip-change finished (%i)\n", status);
}
sched_yield();
pd->res = status;
@@ -149,7 +149,7 @@ static void ev_ppp_pre_up(struct ppp_t *ppp)
pd->ip_pre_up_hnd.pid = pid;
sigchld_register_handler(&pd->ip_pre_up_hnd);
if (conf_verbose)
- log_ppp_info("pppd_compat: ip-pre-up started (pid %i)\n", pid);
+ log_ppp_info2("pppd_compat: ip-pre-up started (pid %i)\n", pid);
sigchld_unlock();
triton_context_schedule(pd->ppp->ctrl->ctx);
pthread_mutex_lock(&pd->ip_pre_up_hnd.lock);
@@ -195,7 +195,7 @@ static void ev_ppp_started(struct ppp_t *ppp)
pd->ip_up_hnd.pid = pid;
sigchld_register_handler(&pd->ip_up_hnd);
if (conf_verbose)
- log_ppp_info("pppd_compat: ip-up started (pid %i)\n", pid);
+ log_ppp_info2("pppd_compat: ip-up started (pid %i)\n", pid);
sigchld_unlock();
} else if (pid == 0) {
execve(conf_ip_up, argv, env);
@@ -272,7 +272,7 @@ static void ev_ppp_finished(struct ppp_t *ppp)
pd->ip_down_hnd.pid = pid;
sigchld_register_handler(&pd->ip_down_hnd);
if (conf_verbose)
- log_ppp_info("pppd_compat: ip-down started (pid %i)\n", pid);
+ log_ppp_info2("pppd_compat: ip-down started (pid %i)\n", pid);
sigchld_unlock();
triton_context_schedule(pd->ppp->ctrl->ctx);
pthread_mutex_lock(&pd->ip_down_hnd.lock);
@@ -343,7 +343,7 @@ static void ev_radius_coa(struct ev_radius_t *ev)
sigchld_register_handler(&pd->ip_change_hnd);
sigchld_unlock();
if (conf_verbose)
- log_ppp_info("pppd_compat: ip-change started (pid %i)\n", pid);
+ log_ppp_info2("pppd_compat: ip-change started (pid %i)\n", pid);
triton_context_schedule(pd->ppp->ctrl->ctx);
if (!ev->res)
ev->res = pd->res;
diff --git a/accel-pptpd/extra/shaper_tbf.c b/accel-pptpd/extra/shaper_tbf.c
index 27b51a1..965fd16 100644
--- a/accel-pptpd/extra/shaper_tbf.c
+++ b/accel-pptpd/extra/shaper_tbf.c
@@ -603,7 +603,7 @@ static void ev_radius_access_accept(struct ev_radius_t *ev)
if (down_speed > 0 && up_speed > 0) {
if (!install_shaper(ev->ppp->ifname, down_speed, down_burst, up_speed, up_burst)) {
if (conf_verbose)
- log_ppp_info("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
+ log_ppp_info2("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
}
}
}
@@ -651,11 +651,11 @@ static void ev_radius_coa(struct ev_radius_t *ev)
return;
} else {
if (conf_verbose)
- log_ppp_info("tbf: changed shaper %i/%i (Kbit)\n", down_speed, up_speed);
+ log_ppp_info2("tbf: changed shaper %i/%i (Kbit)\n", down_speed, up_speed);
}
} else {
if (conf_verbose)
- log_ppp_info("tbf: removed shaper\n");
+ log_ppp_info2("tbf: removed shaper\n");
}
}
}
@@ -678,7 +678,7 @@ static void ev_shaper(struct ev_shaper_t *ev)
pd->up_speed = up_speed;
if (!install_shaper(ev->ppp->ifname, down_speed, down_burst, up_speed, up_burst)) {
if (conf_verbose)
- log_ppp_info("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
+ log_ppp_info2("tbf: installed shaper %i/%i (Kbit)\n", down_speed, up_speed);
}
}
}
diff --git a/accel-pptpd/log.c b/accel-pptpd/log.c
index 582c250..7d0b485 100644
--- a/accel-pptpd/log.c
+++ b/accel-pptpd/log.c
@@ -115,12 +115,22 @@ void __export log_warn(const char *fmt,...)
}
}
-void __export log_info(const char *fmt,...)
+void __export log_info1(const char *fmt,...)
{
- if (log_level >= LOG_INFO) {
+ if (log_level >= LOG_INFO1) {
va_list ap;
va_start(ap, fmt);
- do_log(LOG_INFO, fmt, ap, NULL);
+ do_log(LOG_INFO1, fmt, ap, NULL);
+ va_end(ap);
+ }
+}
+
+void __export log_info2(const char *fmt,...)
+{
+ if (log_level >= LOG_INFO2) {
+ va_list ap;
+ va_start(ap, fmt);
+ do_log(LOG_INFO2, fmt, ap, NULL);
va_end(ap);
}
}
@@ -171,12 +181,22 @@ void __export log_ppp_warn(const char *fmt,...)
}
}
-void __export log_ppp_info(const char *fmt,...)
+void __export log_ppp_info1(const char *fmt,...)
+{
+ if (log_level >= LOG_INFO1) {
+ va_list ap;
+ va_start(ap, fmt);
+ do_log(LOG_INFO1, fmt, ap, cur_ppp);
+ va_end(ap);
+ }
+}
+
+void __export log_ppp_info2(const char *fmt,...)
{
- if (log_level >= LOG_INFO) {
+ if (log_level >= LOG_INFO2) {
va_list ap;
va_start(ap, fmt);
- do_log(LOG_INFO, fmt, ap, cur_ppp);
+ do_log(LOG_INFO2, fmt, ap, cur_ppp);
va_end(ap);
}
}
diff --git a/accel-pptpd/log.h b/accel-pptpd/log.h
index ac2b799..d87c42c 100644
--- a/accel-pptpd/log.h
+++ b/accel-pptpd/log.h
@@ -8,8 +8,9 @@
#define LOG_MSG 0
#define LOG_ERROR 1
#define LOG_WARN 2
-#define LOG_INFO 3
-#define LOG_DEBUG 4
+#define LOG_INFO1 3
+#define LOG_INFO2 4
+#define LOG_DEBUG 5
#define LOG_CHUNK_SIZE 128
#define LOG_MAX_SIZE 4096
@@ -49,13 +50,15 @@ void log_emerg(const char *fmt, ...);
void log_error(const char *fmt,...);
void log_warn(const char *fmt,...);
-void log_info(const char *fmt,...);
+void log_info1(const char *fmt,...);
+void log_info2(const char *fmt,...);
void log_debug(const char *fmt,...);
void log_msg(const char *fmt,...);
void log_ppp_error(const char *fmt,...);
void log_ppp_warn(const char *fmt,...);
-void log_ppp_info(const char *fmt,...);
+void log_ppp_info1(const char *fmt,...);
+void log_ppp_info2(const char *fmt,...);
void log_ppp_debug(const char *fmt,...);
void log_ppp_msg(const char *fmt,...);
diff --git a/accel-pptpd/logs/log_file.c b/accel-pptpd/logs/log_file.c
index 4c4b382..ad0a287 100644
--- a/accel-pptpd/logs/log_file.c
+++ b/accel-pptpd/logs/log_file.c
@@ -51,8 +51,8 @@ static char *conf_per_user_dir;
static char *conf_per_session_dir;
static int conf_copy;
-static const char* level_name[]={" msg", "error", " warn", " info", "debug"};
-static const char* level_color[]={NORMAL_COLOR, RED_COLOR, YELLOW_COLOR, GREEN_COLOR, BLUE_COLOR};
+static const char* level_name[]={" msg", "error", " warn", " info", " info", "debug"};
+static const char* level_color[]={NORMAL_COLOR, RED_COLOR, YELLOW_COLOR, GREEN_COLOR, GREEN_COLOR, BLUE_COLOR};
static void *pd_key1;
static void *pd_key2;
diff --git a/accel-pptpd/logs/log_tcp.c b/accel-pptpd/logs/log_tcp.c
index 98b8a41..41f4bf4 100644
--- a/accel-pptpd/logs/log_tcp.c
+++ b/accel-pptpd/logs/log_tcp.c
@@ -39,7 +39,7 @@ static int conf_queue_len = 1000;
static struct triton_context_t tcp_ctx;
-static const char* level_name[]={" msg", "error", " warn", " info", "debug"};
+static const char* level_name[]={" msg", "error", " warn", " info", " info", "debug"};
static void start_connect(struct tcp_target_t *t);
diff --git a/accel-pptpd/main.c b/accel-pptpd/main.c
index c279574..81537b0 100644
--- a/accel-pptpd/main.c
+++ b/accel-pptpd/main.c
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
sigaddset(&set, SIGBUS);
sigwait(&set, &sig);
- log_info("terminate, sig = %i\n", sig);
+ log_info1("terminate, sig = %i\n", sig);
triton_terminate();
diff --git a/accel-pptpd/ppp/ppp.c b/accel-pptpd/ppp/ppp.c
index a30fa81..84f47f2 100644
--- a/accel-pptpd/ppp/ppp.c
+++ b/accel-pptpd/ppp/ppp.c
@@ -128,8 +128,7 @@ int __export establish_ppp(struct ppp_t *ppp)
generate_sessionid(ppp);
sprintf(ppp->ifname, "ppp%i", ppp->unit_idx);
- if (conf_ppp_verbose)
- log_ppp_info("connect: %s <--> %s(%s)\n", ppp->ifname, ppp->ctrl->name, ppp->chan_name);
+ log_ppp_info1("connect: %s <--> %s(%s)\n", ppp->ifname, ppp->ctrl->name, ppp->chan_name);
init_layers(ppp);
diff --git a/accel-pptpd/ppp/ppp_auth.c b/accel-pptpd/ppp/ppp_auth.c
index 0683593..32413c6 100644
--- a/accel-pptpd/ppp/ppp_auth.c
+++ b/accel-pptpd/ppp/ppp_auth.c
@@ -305,11 +305,16 @@ void __export ppp_auth_successed(struct ppp_t *ppp, char *username)
log_ppp_debug("auth_layer_started\n");
ppp->username = username;
ppp_layer_started(ppp, &ad->ld);
+ log_ppp_info1("%s: authentication successed\n", username);
triton_event_fire(EV_PPP_AUTHORIZED, ppp);
}
-void __export ppp_auth_failed(struct ppp_t *ppp)
+void __export ppp_auth_failed(struct ppp_t *ppp, const char *username)
{
+ if (username)
+ log_ppp_info1("%s: authentication failed\n", username);
+ else
+ log_ppp_info1("authentication failed\n");
ppp_terminate(ppp, TERM_AUTH_ERROR, 0);
}
diff --git a/accel-pptpd/ppp/ppp_auth.h b/accel-pptpd/ppp/ppp_auth.h
index ea12d9c..87cc742 100644
--- a/accel-pptpd/ppp/ppp_auth.h
+++ b/accel-pptpd/ppp/ppp_auth.h
@@ -30,7 +30,7 @@ struct ppp_auth_handler_t
int ppp_auth_register_handler(struct ppp_auth_handler_t*);
void ppp_auth_successed(struct ppp_t *ppp, char *username);
-void ppp_auth_failed(struct ppp_t *ppp);
+void ppp_auth_failed(struct ppp_t *ppp, const char *username);
int ppp_auth_restart(struct ppp_t *ppp);
#endif
diff --git a/accel-pptpd/ppp/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c
index dd63c71..2cad386 100644
--- a/accel-pptpd/ppp/ppp_ccp.c
+++ b/accel-pptpd/ppp/ppp_ccp.c
@@ -206,11 +206,11 @@ static void print_ropt(struct recv_opt_t *ropt)
int i;
uint8_t *ptr = (uint8_t*)ropt->hdr;
- log_ppp_info("<");
+ log_ppp_info2("<");
for (i = 0; i < ropt->len; i++) {
- log_ppp_info(" %x", ptr[i]);
+ log_ppp_info2(" %x", ptr[i]);
}
- log_ppp_info(" >");
+ log_ppp_info2(" >");
}
static int send_conf_req(struct ppp_fsm_t *fsm)
@@ -239,7 +239,7 @@ static int send_conf_req(struct ppp_fsm_t *fsm)
ptr = (uint8_t*)(ccp_hdr + 1);
if (conf_ppp_verbose)
- log_ppp_info("send [CCP ConfReq id=%x", ccp_hdr->id);
+ log_ppp_info2("send [CCP ConfReq id=%x", ccp_hdr->id);
list_for_each_entry(lopt, &ccp->options, entry) {
n = lopt->h->send_conf_req(ccp, lopt, ptr);
@@ -247,15 +247,15 @@ static int send_conf_req(struct ppp_fsm_t *fsm)
return -1;
if (n) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, NULL);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, NULL);
}
}
ptr += n;
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
ccp_hdr->len = htons(ptr - buf - 2);
ppp_unit_send(ccp->ppp, ccp_hdr, ptr - buf);
@@ -273,7 +273,7 @@ static void send_conf_ack(struct ppp_fsm_t *fsm)
hdr->code = CONFACK;
if (conf_ppp_verbose)
- log_ppp_info("send [CCP ConfAck id=%x]\n", ccp->fsm.recv_id);
+ log_ppp_info2("send [CCP ConfAck id=%x]\n", ccp->fsm.recv_id);
ppp_unit_send(ccp->ppp,hdr,ntohs(hdr->len)+2);
}
@@ -286,7 +286,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
struct recv_opt_t *ropt;
if (conf_ppp_verbose)
- log_ppp_info("send [CCP ConfNak id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("send [CCP ConfNak id=%x", ccp->fsm.recv_id);
ccp_hdr->proto = htons(PPP_CCP);
ccp_hdr->code = CONFNAK;
@@ -298,15 +298,15 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
list_for_each_entry(ropt, &ccp->ropt_list, entry) {
if (ropt->state == CCP_OPT_NAK) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- ropt->lopt->h->print(log_ppp_info, ropt->lopt, NULL);
+ log_ppp_info2(" ");
+ ropt->lopt->h->print(log_ppp_info2, ropt->lopt, NULL);
}
ptr += ropt->lopt->h->send_conf_nak(ccp, ropt->lopt, ptr);
}
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
ccp_hdr->len = htons(ptr - buf - 2);
ppp_unit_send(ccp->ppp, ccp_hdr, ptr - buf);
@@ -322,7 +322,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
struct recv_opt_t *ropt;
if (conf_ppp_verbose)
- log_ppp_info("send [CCP ConfRej id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("send [CCP ConfRej id=%x", ccp->fsm.recv_id);
ccp_hdr->proto = htons(PPP_CCP);
ccp_hdr->code = CONFREJ;
@@ -334,9 +334,9 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
list_for_each_entry(ropt, &ccp->ropt_list, entry) {
if (ropt->state == CCP_OPT_REJ) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
if (ropt->lopt)
- ropt->lopt->h->print(log_ppp_info, ropt->lopt, (uint8_t*)ropt->hdr);
+ ropt->lopt->h->print(log_ppp_info2, ropt->lopt, (uint8_t*)ropt->hdr);
else
print_ropt(ropt);
}
@@ -346,7 +346,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
ccp_hdr->len = htons(ptr - buf - 2);
ppp_unit_send(ccp->ppp, ccp_hdr, ptr-buf);
@@ -384,14 +384,14 @@ static int ccp_recv_conf_req(struct ppp_ccp_t *ccp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP ConfReq id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("recv [CCP ConfReq id=%x", ccp->fsm.recv_id);
list_for_each_entry(ropt, &ccp->ropt_list, entry) {
list_for_each_entry(lopt, &ccp->options, entry) {
if (lopt->id == ropt->hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, (uint8_t*)ropt->hdr);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, (uint8_t*)ropt->hdr);
}
r = lopt->h->recv_conf_req(ccp, lopt, (uint8_t*)ropt->hdr);
if (ack) {
@@ -413,7 +413,7 @@ static int ccp_recv_conf_req(struct ppp_ccp_t *ccp, uint8_t *data, int size)
ack = 1;
else if (!ropt->lopt) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
print_ropt(ropt);
}
ropt->state = CCP_OPT_REJ;
@@ -422,7 +422,7 @@ static int ccp_recv_conf_req(struct ppp_ccp_t *ccp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
/*list_for_each_entry(lopt,&ccp->options,entry)
{
@@ -455,11 +455,11 @@ static int ccp_recv_conf_rej(struct ppp_ccp_t *ccp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP ConfRej id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("recv [CCP ConfRej id=%x", ccp->fsm.recv_id);
if (ccp->fsm.recv_id != ccp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -481,7 +481,7 @@ static int ccp_recv_conf_rej(struct ppp_ccp_t *ccp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -493,11 +493,11 @@ static int ccp_recv_conf_nak(struct ppp_ccp_t *ccp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP ConfNak id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("recv [CCP ConfNak id=%x", ccp->fsm.recv_id);
if (ccp->fsm.recv_id != ccp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -507,8 +507,8 @@ static int ccp_recv_conf_nak(struct ppp_ccp_t *ccp, uint8_t *data, int size)
list_for_each_entry(lopt, &ccp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, data);
}
if (lopt->h->recv_conf_nak && lopt->h->recv_conf_nak(ccp, lopt, data))
res = -1;
@@ -523,7 +523,7 @@ static int ccp_recv_conf_nak(struct ppp_ccp_t *ccp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -535,11 +535,11 @@ static int ccp_recv_conf_ack(struct ppp_ccp_t *ccp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP ConfAck id=%x", ccp->fsm.recv_id);
+ log_ppp_info2("recv [CCP ConfAck id=%x", ccp->fsm.recv_id);
if (ccp->fsm.recv_id != ccp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -549,8 +549,8 @@ static int ccp_recv_conf_ack(struct ppp_ccp_t *ccp, uint8_t *data, int size)
list_for_each_entry(lopt, &ccp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info,lopt,data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2,lopt,data);
}
if (!lopt->h->recv_conf_ack)
break;
@@ -565,7 +565,7 @@ static int ccp_recv_conf_ack(struct ppp_ccp_t *ccp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -581,7 +581,7 @@ static void send_term_req(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CCP TermReq id=%i]\n", hdr.id);
+ log_ppp_info2("send [CCP TermReq id=%i]\n", hdr.id);
ppp_chan_send(ccp->ppp, &hdr, 6);
}
@@ -597,7 +597,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [CCP TermAck id=%i]\n", hdr.id);
+ log_ppp_info2("send [CCP TermAck id=%i]\n", hdr.id);
ppp_chan_send(ccp->ppp, &hdr, 6);
}
@@ -672,18 +672,18 @@ static void ccp_recv(struct ppp_handler_t*h)
break;
case TERMREQ:
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP TermReq id=%x]\n", hdr->id);
+ log_ppp_info2("recv [CCP TermReq id=%x]\n", hdr->id);
ppp_fsm_recv_term_req(&ccp->fsm);
ppp_fsm_close(&ccp->fsm);
break;
case TERMACK:
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP TermAck id=%x]\n", hdr->id);
+ log_ppp_info2("recv [CCP TermAck id=%x]\n", hdr->id);
ppp_fsm_recv_term_ack(&ccp->fsm);
break;
case CODEREJ:
if (conf_ppp_verbose)
- log_ppp_info("recv [CCP CodeRej id=%x]\n", hdr->id);
+ log_ppp_info2("recv [CCP CodeRej id=%x]\n", hdr->id);
ppp_fsm_recv_code_rej_bad(&ccp->fsm);
break;
default:
diff --git a/accel-pptpd/ppp/ppp_ipcp.c b/accel-pptpd/ppp/ppp_ipcp.c
index 3229893..0e743a1 100644
--- a/accel-pptpd/ppp/ppp_ipcp.c
+++ b/accel-pptpd/ppp/ppp_ipcp.c
@@ -164,11 +164,11 @@ static void print_ropt(struct recv_opt_t *ropt)
int i;
uint8_t *ptr = (uint8_t*)ropt->hdr;
- log_ppp_info("<");
+ log_ppp_info2("<");
for (i = 0; i < ropt->len; i++) {
- log_ppp_info(" %x", ptr[i]);
+ log_ppp_info2(" %x", ptr[i]);
}
- log_ppp_info(" >");
+ log_ppp_info2(" >");
}
static int send_conf_req(struct ppp_fsm_t *fsm)
@@ -198,14 +198,14 @@ static int send_conf_req(struct ppp_fsm_t *fsm)
}
if (conf_ppp_verbose) {
- log_ppp_info("send [IPCP ConfReq id=%x", ipcp_hdr->id);
+ log_ppp_info2("send [IPCP ConfReq id=%x", ipcp_hdr->id);
list_for_each_entry(lopt,&ipcp->options,entry) {
if (lopt->print) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, NULL);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, NULL);
}
}
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
}
ipcp_hdr->len = htons(ptr - buf - 2);
@@ -224,7 +224,7 @@ static void send_conf_ack(struct ppp_fsm_t *fsm)
hdr->code = CONFACK;
if (conf_ppp_verbose)
- log_ppp_info("send [IPCP ConfAck id=%x]\n", ipcp->fsm.recv_id);
+ log_ppp_info2("send [IPCP ConfAck id=%x]\n", ipcp->fsm.recv_id);
ppp_unit_send(ipcp->ppp, hdr, ntohs(hdr->len) + 2);
}
@@ -237,7 +237,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
struct recv_opt_t *ropt;
if (conf_ppp_verbose)
- log_ppp_info("send [IPCP ConfNak id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("send [IPCP ConfNak id=%x", ipcp->fsm.recv_id);
ipcp_hdr->proto = htons(PPP_IPCP);
ipcp_hdr->code = CONFNAK;
@@ -249,15 +249,15 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
list_for_each_entry(ropt, &ipcp->ropt_list, entry) {
if (ropt->state == IPCP_OPT_NAK) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- ropt->lopt->h->print(log_ppp_info, ropt->lopt, NULL);
+ log_ppp_info2(" ");
+ ropt->lopt->h->print(log_ppp_info2, ropt->lopt, NULL);
}
ptr += ropt->lopt->h->send_conf_nak(ipcp, ropt->lopt, ptr);
}
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
ipcp_hdr->len = htons(ptr-buf-2);
ppp_unit_send(ipcp->ppp, ipcp_hdr, ptr - buf);
@@ -273,7 +273,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
struct recv_opt_t *ropt;
if (conf_ppp_verbose)
- log_ppp_info("send [IPCP ConfRej id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("send [IPCP ConfRej id=%x", ipcp->fsm.recv_id);
ipcp_hdr->proto = htons(PPP_IPCP);
ipcp_hdr->code = CONFREJ;
@@ -285,9 +285,9 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
list_for_each_entry(ropt, &ipcp->ropt_list, entry) {
if (ropt->state == IPCP_OPT_REJ) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
if (ropt->lopt)
- ropt->lopt->h->print(log_ppp_info, ropt->lopt, (uint8_t*)ropt->hdr);
+ ropt->lopt->h->print(log_ppp_info2, ropt->lopt, (uint8_t*)ropt->hdr);
else
print_ropt(ropt);
}
@@ -297,7 +297,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
ipcp_hdr->len = htons(ptr - buf - 2);
ppp_unit_send(ipcp->ppp, ipcp_hdr, ptr-buf);
@@ -336,23 +336,23 @@ static int ipcp_recv_conf_req(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
lopt->state=IPCP_OPT_NONE;
if (conf_ppp_verbose) {
- log_ppp_info("recv [IPCP ConfReq id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("recv [IPCP ConfReq id=%x", ipcp->fsm.recv_id);
list_for_each_entry(ropt, &ipcp->ropt_list, entry) {
list_for_each_entry(lopt, &ipcp->options, entry) {
if (lopt->id == ropt->hdr->id) {
ropt->lopt = lopt;
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, (uint8_t*)ropt->hdr);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, (uint8_t*)ropt->hdr);
break;
}
}
if (!ropt->lopt) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
print_ropt(ropt);
}
}
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
}
list_for_each_entry(ropt, &ipcp->ropt_list, entry) {
@@ -407,11 +407,11 @@ static int ipcp_recv_conf_rej(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP ConfRej id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("recv [IPCP ConfRej id=%x", ipcp->fsm.recv_id);
if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -433,7 +433,7 @@ static int ipcp_recv_conf_rej(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -445,11 +445,11 @@ static int ipcp_recv_conf_nak(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP ConfNak id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("recv [IPCP ConfNak id=%x", ipcp->fsm.recv_id);
if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -459,8 +459,8 @@ static int ipcp_recv_conf_nak(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
list_for_each_entry(lopt, &ipcp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info,lopt,data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2,lopt,data);
}
if (lopt->h->recv_conf_nak && lopt->h->recv_conf_nak(ipcp, lopt, data))
res =- 1;
@@ -473,7 +473,7 @@ static int ipcp_recv_conf_nak(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -485,11 +485,11 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP ConfAck id=%x", ipcp->fsm.recv_id);
+ log_ppp_info2("recv [IPCP ConfAck id=%x", ipcp->fsm.recv_id);
if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -499,8 +499,8 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
list_for_each_entry(lopt, &ipcp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, data);
}
if (!lopt->h->recv_conf_ack)
break;
@@ -515,7 +515,7 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -531,7 +531,7 @@ static void send_term_req(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [IPCP TermReq id=%i]\n", hdr.id);
+ log_ppp_info2("send [IPCP TermReq id=%i]\n", hdr.id);
ppp_unit_send(ipcp->ppp, &hdr, 6);
}
@@ -547,7 +547,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [IPCP TermAck id=%i]\n", hdr.id);
+ log_ppp_info2("send [IPCP TermAck id=%i]\n", hdr.id);
ppp_unit_send(ipcp->ppp, &hdr, 6);
}
@@ -616,19 +616,19 @@ static void ipcp_recv(struct ppp_handler_t*h)
break;
case TERMREQ:
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP TermReq id=%x]\n", hdr->id);
+ log_ppp_info2("recv [IPCP TermReq id=%x]\n", hdr->id);
ppp_fsm_recv_term_req(&ipcp->fsm);
ppp_terminate(ipcp->ppp, TERM_USER_REQUEST, 0);
break;
case TERMACK:
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP TermAck id=%x]\n", hdr->id);
+ log_ppp_info2("recv [IPCP TermAck id=%x]\n", hdr->id);
//ppp_fsm_recv_term_ack(&ipcp->fsm);
//ppp_terminate(ipcp->ppp, 0);
break;
case CODEREJ:
if (conf_ppp_verbose)
- log_ppp_info("recv [IPCP CodeRej id=%x]\n", hdr->id);
+ log_ppp_info2("recv [IPCP CodeRej id=%x]\n", hdr->id);
ppp_fsm_recv_code_rej_bad(&ipcp->fsm);
break;
default:
diff --git a/accel-pptpd/ppp/ppp_lcp.c b/accel-pptpd/ppp/ppp_lcp.c
index 5416019..8c539a7 100644
--- a/accel-pptpd/ppp/ppp_lcp.c
+++ b/accel-pptpd/ppp/ppp_lcp.c
@@ -186,11 +186,11 @@ static void print_ropt(struct recv_opt_t *ropt)
int i;
uint8_t *ptr = (uint8_t*)ropt->hdr;
- log_ppp_info("<");
+ log_ppp_info2("<");
for (i = 0; i < ropt->len; i++) {
- log_ppp_info(" %x", ptr[i]);
+ log_ppp_info2(" %x", ptr[i]);
}
- log_ppp_info(" >");
+ log_ppp_info2(" >");
}
static int send_conf_req(struct ppp_fsm_t *fsm)
@@ -220,14 +220,14 @@ static int send_conf_req(struct ppp_fsm_t *fsm)
}
if (conf_ppp_verbose) {
- log_ppp_info("send [LCP ConfReq id=%x", lcp_hdr->id);
+ log_ppp_info2("send [LCP ConfReq id=%x", lcp_hdr->id);
list_for_each_entry(lopt,&lcp->options,entry) {
if (lopt->print) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, NULL);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, NULL);
}
}
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
}
lcp_hdr->len = htons(ptr - buf - 2);
@@ -246,7 +246,7 @@ static void send_conf_ack(struct ppp_fsm_t *fsm)
hdr->code = CONFACK;
if (conf_ppp_verbose)
- log_ppp_info("send [LCP ConfAck id=%x ]\n", lcp->fsm.recv_id);
+ log_ppp_info2("send [LCP ConfAck id=%x ]\n", lcp->fsm.recv_id);
ppp_chan_send(lcp->ppp, hdr, ntohs(hdr->len) + 2);
}
@@ -259,7 +259,7 @@ static void send_code_rej(struct ppp_fsm_t *fsm)
hdr->code = CONFACK;
if (conf_ppp_verbose)
- log_ppp_info("send [LCP CodeRej %x id=%x ]\n",hdr->code, lcp->fsm.recv_id);
+ log_ppp_info2("send [LCP CodeRej %x id=%x ]\n",hdr->code, lcp->fsm.recv_id);
ppp_chan_send(lcp->ppp, hdr, ntohs(hdr->len) + 2);
}
@@ -272,7 +272,7 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
struct lcp_option_t *lopt;
if (conf_ppp_verbose)
- log_ppp_info("send [LCP ConfNak id=%x", lcp->fsm.recv_id);
+ log_ppp_info2("send [LCP ConfNak id=%x", lcp->fsm.recv_id);
lcp_hdr->proto = htons(PPP_LCP);
lcp_hdr->code = CONFNAK;
@@ -286,14 +286,14 @@ static void send_conf_nak(struct ppp_fsm_t *fsm)
ptr+=lopt->h->send_conf_nak(lcp,lopt,ptr);
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, NULL);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, NULL);
}
}
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
lcp_hdr->len = htons(ptr - buf - 2);
ppp_chan_send(lcp->ppp, lcp_hdr,ptr - buf);
@@ -309,7 +309,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
struct recv_opt_t *ropt;
if (conf_ppp_verbose)
- log_ppp_info("send [LCP ConfRej id=%x ", lcp->fsm.recv_id);
+ log_ppp_info2("send [LCP ConfRej id=%x ", lcp->fsm.recv_id);
lcp_hdr->proto = htons(PPP_LCP);
lcp_hdr->code = CONFREJ;
@@ -324,9 +324,9 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
ptr += ropt->len;
if (conf_ppp_verbose) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
if (ropt->lopt)
- ropt->lopt->h->print(log_ppp_info, ropt->lopt, (uint8_t*)ropt->hdr);
+ ropt->lopt->h->print(log_ppp_info2, ropt->lopt, (uint8_t*)ropt->hdr);
else
print_ropt(ropt);
}
@@ -334,7 +334,7 @@ static void send_conf_rej(struct ppp_fsm_t *fsm)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
lcp_hdr->len = htons(ptr - buf - 2);
ppp_chan_send(lcp->ppp, lcp_hdr, ptr - buf);
@@ -374,14 +374,14 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp, uint8_t *data, int size)
lopt->state = LCP_OPT_NONE;
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP ConfReq id=%x", lcp->fsm.recv_id);
+ log_ppp_info2("recv [LCP ConfReq id=%x", lcp->fsm.recv_id);
list_for_each_entry(ropt, &lcp->ropt_list, entry) {
list_for_each_entry(lopt, &lcp->options, entry) {
if (lopt->id == ropt->hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, (uint8_t*)ropt->hdr);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, (uint8_t*)ropt->hdr);
}
r = lopt->h->recv_conf_req(lcp, lopt, (uint8_t*)ropt->hdr);
lopt->state = r;
@@ -394,7 +394,7 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp, uint8_t *data, int size)
}
if (!ropt->lopt) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
+ log_ppp_info2(" ");
print_ropt(ropt);
}
ropt->state=LCP_OPT_REJ;
@@ -403,7 +403,7 @@ static int lcp_recv_conf_req(struct ppp_lcp_t *lcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
/*list_for_each_entry(lopt,&lcp->options,entry)
{
@@ -436,11 +436,11 @@ static int lcp_recv_conf_rej(struct ppp_lcp_t *lcp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP ConfRej id=%x", lcp->fsm.recv_id);
+ log_ppp_info2("recv [LCP ConfRej id=%x", lcp->fsm.recv_id);
if (lcp->fsm.recv_id != lcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -450,8 +450,8 @@ static int lcp_recv_conf_rej(struct ppp_lcp_t *lcp, uint8_t *data, int size)
list_for_each_entry(lopt, &lcp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, (uint8_t*)hdr);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, (uint8_t*)hdr);
}
if (!lopt->h->recv_conf_rej)
res = -1;
@@ -466,7 +466,7 @@ static int lcp_recv_conf_rej(struct ppp_lcp_t *lcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -478,11 +478,11 @@ static int lcp_recv_conf_nak(struct ppp_lcp_t *lcp, uint8_t *data, int size)
int res = 0;
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP ConfNak id=%x", lcp->fsm.recv_id);
+ log_ppp_info2("recv [LCP ConfNak id=%x", lcp->fsm.recv_id);
if (lcp->fsm.recv_id != lcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -492,8 +492,8 @@ static int lcp_recv_conf_nak(struct ppp_lcp_t *lcp, uint8_t *data, int size)
list_for_each_entry(lopt,&lcp->options,entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, data);
}
if (lopt->h->recv_conf_nak && lopt->h->recv_conf_nak(lcp, lopt, data))
res = -1;
@@ -506,7 +506,7 @@ static int lcp_recv_conf_nak(struct ppp_lcp_t *lcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -518,11 +518,11 @@ static int lcp_recv_conf_ack(struct ppp_lcp_t *lcp, uint8_t *data, int size)
int res=0;
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP ConfAck id=%x", lcp->fsm.recv_id);
+ log_ppp_info2("recv [LCP ConfAck id=%x", lcp->fsm.recv_id);
if (lcp->fsm.recv_id != lcp->fsm.id) {
if (conf_ppp_verbose)
- log_ppp_info(": id mismatch ]\n");
+ log_ppp_info2(": id mismatch ]\n");
return 0;
}
@@ -532,8 +532,8 @@ static int lcp_recv_conf_ack(struct ppp_lcp_t *lcp, uint8_t *data, int size)
list_for_each_entry(lopt, &lcp->options, entry) {
if (lopt->id == hdr->id) {
if (conf_ppp_verbose) {
- log_ppp_info(" ");
- lopt->h->print(log_ppp_info, lopt, data);
+ log_ppp_info2(" ");
+ lopt->h->print(log_ppp_info2, lopt, data);
}
if (!lopt->h->recv_conf_ack)
break;
@@ -548,7 +548,7 @@ static int lcp_recv_conf_ack(struct ppp_lcp_t *lcp, uint8_t *data, int size)
}
if (conf_ppp_verbose)
- log_ppp_info("]\n");
+ log_ppp_info2("]\n");
return res;
}
@@ -639,7 +639,7 @@ static void send_term_req(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [LCP TermReq id=%i]\n", hdr.id);
+ log_ppp_info2("send [LCP TermReq id=%i]\n", hdr.id);
ppp_chan_send(lcp->ppp, &hdr, 6);
}
@@ -655,7 +655,7 @@ static void send_term_ack(struct ppp_fsm_t *fsm)
};
if (conf_ppp_verbose)
- log_ppp_info("send [LCP TermAck id=%i]\n", hdr.id);
+ log_ppp_info2("send [LCP TermAck id=%i]\n", hdr.id);
ppp_chan_send(lcp->ppp, &hdr, 6);
}
@@ -676,7 +676,7 @@ void lcp_send_proto_rej(struct ppp_t *ppp, uint16_t proto)
};
if (conf_ppp_verbose)
- log_ppp_info("send [LCP ProtoRej id=%i <%04x>]\n", msg.hdr.id, proto);
+ log_ppp_info2("send [LCP ProtoRej id=%i <%04x>]\n", msg.hdr.id, proto);
ppp_chan_send(lcp->ppp, &msg, sizeof(msg));
}
@@ -749,18 +749,18 @@ static void lcp_recv(struct ppp_handler_t*h)
break;
case TERMREQ:
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP TermReq id=%x]\n", hdr->id);
+ log_ppp_info2("recv [LCP TermReq id=%x]\n", hdr->id);
ppp_fsm_recv_term_req(&lcp->fsm);
ppp_terminate(lcp->ppp, TERM_USER_REQUEST, 0);
break;
case TERMACK:
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP TermAck id=%x]\n", hdr->id);
+ log_ppp_info2("recv [LCP TermAck id=%x]\n", hdr->id);
ppp_fsm_recv_term_ack(&lcp->fsm);
break;
case CODEREJ:
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP CodeRej id=%x]\n", hdr->id);
+ log_ppp_info2("recv [LCP CodeRej id=%x]\n", hdr->id);
ppp_fsm_recv_code_rej_bad(&lcp->fsm);
break;
case ECHOREQ:
@@ -773,19 +773,19 @@ static void lcp_recv(struct ppp_handler_t*h)
break;
case PROTOREJ:
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP ProtoRej id=%x <%04x>]\n", hdr->code, hdr->id, ntohs(*(uint16_t*)(hdr + 1)));
+ log_ppp_info2("recv [LCP ProtoRej id=%x <%04x>]\n", hdr->code, hdr->id, ntohs(*(uint16_t*)(hdr + 1)));
ppp_recv_proto_rej(lcp->ppp, ntohs(*(uint16_t *)(hdr + 1)));
break;
case IDENT:
if (conf_ppp_verbose) {
term_msg = _strndup((char*)(hdr + 1) + 4, ntohs(hdr->len) - 4 - 4);
- log_ppp_info("recv [LCP Ident id=%x <%s>]\n", hdr->id, term_msg);
+ log_ppp_info2("recv [LCP Ident id=%x <%s>]\n", hdr->id, term_msg);
_free(term_msg);
}
break;
default:
if (conf_ppp_verbose)
- log_ppp_info("recv [LCP Unknown %x]\n", hdr->code);
+ log_ppp_info2("recv [LCP Unknown %x]\n", hdr->code);
ppp_fsm_recv_unk(&lcp->fsm);
break;
}
diff --git a/accel-pptpd/radius/acct.c b/accel-pptpd/radius/acct.c
index cc0fdea..cff2d09 100644
--- a/accel-pptpd/radius/acct.c
+++ b/accel-pptpd/radius/acct.c
@@ -86,8 +86,8 @@ static int rad_acct_read(struct triton_md_handler_t *h)
rad_packet_free(req->reply);
req->reply = pack;
if (conf_interim_verbose) {
- log_ppp_info("recv ");
- rad_packet_print(req->reply, log_ppp_info);
+ log_ppp_info2("recv ");
+ rad_packet_print(req->reply, log_ppp_info2);
}
}
diff --git a/accel-pptpd/radius/dm_coa.c b/accel-pptpd/radius/dm_coa.c
index 5edbdd9..d78f91a 100644
--- a/accel-pptpd/radius/dm_coa.c
+++ b/accel-pptpd/radius/dm_coa.c
@@ -77,8 +77,8 @@ static int dm_coa_send_ack(int fd, struct rad_packet_t *req, struct sockaddr_in
dm_coa_set_RA(reply, conf_dm_coa_secret);
if (conf_verbose) {
- log_ppp_info("send ");
- rad_packet_print(reply, log_ppp_info);
+ log_ppp_info2("send ");
+ rad_packet_print(reply, log_ppp_info2);
}
rad_packet_send(reply, fd, addr);
@@ -112,8 +112,8 @@ static int dm_coa_send_nak(int fd, struct rad_packet_t *req, struct sockaddr_in
dm_coa_set_RA(reply, conf_dm_coa_secret);
if (conf_verbose) {
- log_ppp_info("send ");
- rad_packet_print(reply, log_ppp_info);
+ log_ppp_info2("send ");
+ rad_packet_print(reply, log_ppp_info2);
}
rad_packet_send(reply, fd, addr);
@@ -127,8 +127,8 @@ static int dm_coa_send_nak(int fd, struct rad_packet_t *req, struct sockaddr_in
static void disconnect_request(struct radius_pd_t *rpd)
{
if (conf_verbose) {
- log_ppp_info("recv ");
- rad_packet_print(rpd->dm_coa_req, log_ppp_info);
+ log_ppp_info2("recv ");
+ rad_packet_print(rpd->dm_coa_req, log_ppp_info2);
}
dm_coa_send_ack(serv.hnd.fd, rpd->dm_coa_req, &rpd->dm_coa_addr);
@@ -150,8 +150,8 @@ static void coa_request(struct radius_pd_t *rpd)
};
if (conf_verbose) {
- log_ppp_info("recv ");
- rad_packet_print(rpd->dm_coa_req, log_ppp_info);
+ log_ppp_info2("recv ");
+ rad_packet_print(rpd->dm_coa_req, log_ppp_info2);
}
triton_event_fire(EV_RADIUS_COA, &ev);
diff --git a/accel-pptpd/radius/req.c b/accel-pptpd/radius/req.c
index 27a661b..818ceb4 100644
--- a/accel-pptpd/radius/req.c
+++ b/accel-pptpd/radius/req.c
@@ -178,8 +178,8 @@ int rad_req_send(struct rad_req_t *req, int verbose)
goto out_err;
if (verbose) {
- log_ppp_info("send ");
- rad_packet_print(req->pack, log_ppp_info);
+ log_ppp_info1("send ");
+ rad_packet_print(req->pack, log_ppp_info1);
}
rad_packet_send(req->pack, req->hnd.fd, NULL);
@@ -247,8 +247,8 @@ int rad_req_wait(struct rad_req_t *req, int timeout)
triton_context_schedule(req->rpd->ppp->ctrl->ctx);
if (conf_verbose && req->reply) {
- log_ppp_info("recv ");
- rad_packet_print(req->reply, log_ppp_info);
+ log_ppp_info1("recv ");
+ rad_packet_print(req->reply, log_ppp_info1);
}
return 0;
}