summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c9
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.h2
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c1
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c1
-rw-r--r--accel-pppd/ctrl/pptp/pptp.c1
-rw-r--r--accel-pppd/include/ap_session.h1
-rw-r--r--accel-pppd/log.c2
-rw-r--r--accel-pppd/logs/log_file.c2
-rw-r--r--accel-pppd/logs/log_syslog.c2
-rw-r--r--accel-pppd/logs/log_tcp.c2
10 files changed, 14 insertions, 9 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 3edf7f00..e64e19a4 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -1169,7 +1169,7 @@ static struct ipoe_session *ipoe_session_create_dhcpv4(struct ipoe_serv *serv, s
int dlen = 0;
uint8_t *ptr = NULL;
- ses = ipoe_session_alloc();
+ ses = ipoe_session_alloc(serv->ifname);
if (!ses)
return NULL;
@@ -1780,7 +1780,7 @@ static struct ipoe_session *ipoe_session_create_up(struct ipoe_serv *serv, struc
if (l4_redirect_list_check(saddr))
return NULL;
- ses = ipoe_session_alloc();
+ ses = ipoe_session_alloc(serv->ifname);
if (!ses)
return NULL;
@@ -1843,7 +1843,7 @@ static void ipoe_session_create_auto(struct ipoe_serv *serv)
if (ap_shutdown)
return;
- ses = ipoe_session_alloc();
+ ses = ipoe_session_alloc(serv->ifname);
if (!ses)
return;
@@ -1870,7 +1870,7 @@ static void ipoe_session_create_auto(struct ipoe_serv *serv)
triton_context_wakeup(&ses->ctx);
}
-struct ipoe_session *ipoe_session_alloc(void)
+struct ipoe_session *ipoe_session_alloc(const char *ifname)
{
struct ipoe_session *ses;
@@ -1894,6 +1894,7 @@ struct ipoe_session *ipoe_session_alloc(void)
ses->ctrl.terminate = ipoe_session_terminate;
ses->ctrl.type = CTRL_TYPE_IPOE;
ses->ctrl.name = "ipoe";
+ ses->ctrl.ifname = ifname;
ses->l4_redirect_table = conf_l4_redirect_table;
ses->ses.ctrl = &ses->ctrl;
diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h
index 33bd6dfe..e398648e 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.h
+++ b/accel-pppd/ctrl/ipoe/ipoe.h
@@ -130,7 +130,7 @@ struct ethhdr;
void ipoe_recv_up(int ifindex, struct ethhdr *eth, struct iphdr *iph, struct _arphdr *arph);
-struct ipoe_session *ipoe_session_alloc(void);
+struct ipoe_session *ipoe_session_alloc(const char *ifname);
struct ipoe_serv *ipoe_find_serv(const char *ifname);
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 6350e8e3..72264aa5 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1754,6 +1754,7 @@ static int l2tp_session_start_data_channel(struct l2tp_sess_t *sess)
sess->ctrl.type = CTRL_TYPE_L2TP;
sess->ctrl.ppp = 1;
sess->ctrl.name = "l2tp";
+ sess->ctrl.ifname = "";
sess->ctrl.started = apses_started;
sess->ctrl.finished = apses_finished;
sess->ctrl.terminate = ppp_terminate;
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index 87c5b06b..a4d1ca92 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -344,6 +344,7 @@ static struct pppoe_conn_t *allocate_channel(struct pppoe_serv_t *serv, const ui
conn->ctrl.type = CTRL_TYPE_PPPOE;
conn->ctrl.ppp = 1;
conn->ctrl.name = "pppoe";
+ conn->ctrl.ifname = serv->ifname;
conn->ctrl.mppe = conf_mppe;
if (ppp_max_payload > ETH_DATA_LEN - 8)
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index 746badcc..0a0afa4d 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -683,6 +683,7 @@ static int pptp_connect(struct triton_md_handler_t *h)
conn->ctrl.type = CTRL_TYPE_PPTP;
conn->ctrl.ppp = 1;
conn->ctrl.name = "pptp";
+ conn->ctrl.ifname = "";
conn->ctrl.mppe = conf_mppe;
conn->ctrl.calling_station_id = _malloc(17);
diff --git a/accel-pppd/include/ap_session.h b/accel-pppd/include/ap_session.h
index 230eb260..0baaab2c 100644
--- a/accel-pppd/include/ap_session.h
+++ b/accel-pppd/include/ap_session.h
@@ -43,6 +43,7 @@ struct ap_ctrl {
struct triton_context_t *ctx;
int type;
const char *name;
+ const char *ifname;
int max_mtu;
int mppe;
char *calling_station_id;
diff --git a/accel-pppd/log.c b/accel-pppd/log.c
index 0d481ad9..3105e572 100644
--- a/accel-pppd/log.c
+++ b/accel-pppd/log.c
@@ -357,7 +357,7 @@ static void write_msg(FILE *f, struct _log_msg_t *msg, struct ap_session *ses)
fprintf(f, "[%04i-%02i-%02i %02i:%02i:%02i.%03i] ", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, (int)tv.tv_usec/1000);
if (ses)
- fprintf(f, "%s: %s: ", ses->ifname, ses->sessionid);
+ fprintf(f, "%s: %s: ", ses->ifname[0] ? ses->ifname : ses->ctrl->ifname, ses->sessionid);
list_for_each_entry(chunk, &msg->chunks, entry)
fwrite(chunk->msg, chunk->len, 1, f);
diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c
index 30bfde46..6eafd420 100644
--- a/accel-pppd/logs/log_file.c
+++ b/accel-pppd/logs/log_file.c
@@ -245,7 +245,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses)
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &tm);
sprintf(msg->hdr->msg, "%s[%s]: %s: %s%s%s", conf_color ? level_color[msg->level] : "",
timestamp, level_name[msg->level],
- ses ? ses->ifname : "",
+ ses ? (ses->ifname[0] ? ses->ifname : ses->ctrl->ifname) : "",
ses ? ": " : "",
conf_color ? NORMAL_COLOR : "");
msg->hdr->len = strlen(msg->hdr->msg);
diff --git a/accel-pppd/logs/log_syslog.c b/accel-pppd/logs/log_syslog.c
index 36c8775b..562d895f 100644
--- a/accel-pppd/logs/log_syslog.c
+++ b/accel-pppd/logs/log_syslog.c
@@ -53,7 +53,7 @@ static void unpack_msg(struct log_msg_t *msg)
static void set_hdr(struct log_msg_t *msg, struct ap_session *ses)
{
if (ses) {
- if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ses->ifname, ses->username ? ses->username : ""))
+ if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ses->ifname[0] ? ses->ifname : ses->ctrl->ifname, ses->username ? ses->username : ""))
strcpy(msg->hdr->msg + LOG_CHUNK_SIZE - 3, ": ");
} else
msg->hdr->msg[0] = 0;
diff --git a/accel-pppd/logs/log_tcp.c b/accel-pppd/logs/log_tcp.c
index 616809f0..85edf70a 100644
--- a/accel-pppd/logs/log_tcp.c
+++ b/accel-pppd/logs/log_tcp.c
@@ -137,7 +137,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses)
localtime_r(&msg->timestamp.tv_sec, &tm);
strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &tm);
- sprintf(msg->hdr->msg, "[%s]: %s: %s: ", timestamp, level_name[msg->level], ses ? ses->ifname : "");
+ sprintf(msg->hdr->msg, "[%s]: %s: %s: ", timestamp, level_name[msg->level], ses ? (ses->ifname[0] ? ses->ifname : ses->ctrl->ifname) : "");
msg->hdr->len = strlen(msg->hdr->msg);
}