l2tpd: add name to traffic_channels to improve logging

This commit is contained in:
Alexander Couzens 2016-12-05 16:23:51 +01:00 committed by Harald Welte
parent 6b0af57fdf
commit 183f9d6e5c
3 changed files with 8 additions and 4 deletions

View File

@ -133,6 +133,9 @@ int main(int argc, char **argv)
if (rc < 0)
exit(1);
l2i->rsl_oml.name = "RSL/OML";
l2i->trau.name = "TRAU";
l2i->pgsl.name = "P/GSL";
l2tp_socket_init(&l2i->rsl_oml.state, l2i->cfg.rsl_oml_path, 100, DL2TP);
l2tp_socket_init(&l2i->trau.state, l2i->cfg.trau_path, 100, DL2TP);
l2tp_socket_init(&l2i->pgsl.state, l2i->cfg.pgsl_path, 100, DL2TP);

View File

@ -84,6 +84,7 @@ struct l2tpd_session {
struct traffic_channel {
struct l2tp_socket_state state;
struct l2tpd_session *session;
const char *name;
};
struct l2tpd_instance {

View File

@ -255,11 +255,11 @@ int unix_rsl_oml_cb(struct osmo_fd *fd)
rc = read(fd->fd, msg->data, msg->data_len);
if (rc < 0) {
LOGP(DL2TP, LOGL_ERROR, "read failed %s\n", strerror(errno));
LOGP(DL2TP, LOGL_ERROR, "%s: read failed %s\n", channel->name, strerror(errno));
msgb_free(msg);
return rc;
} else if (rc == 0) {
LOGP(DL2TP, LOGL_ERROR, "closing socket because read 0 bytes\n");
LOGP(DL2TP, LOGL_ERROR, "%s: closing socket because read 0 bytes\n", channel->name);
msgb_free(msg);
l2tp_sock_cleanup(fd);
return 0;
@ -269,7 +269,7 @@ int unix_rsl_oml_cb(struct osmo_fd *fd)
msg->dst = channel->session;
if (!channel->session) {
LOGP(DL2TP, LOGL_NOTICE, "Drop packets.\n");
LOGP(DL2TP, LOGL_DEBUG, "%s: Drop incoming packet session is full\n", channel->name);
msgb_free(msg);
return 1;
}
@ -282,7 +282,7 @@ int unix_rsl_oml_cb(struct osmo_fd *fd)
rc = lapd_lapd_to_ehdlc(l2i, msg);
if (rc) {
LOGP(DL2TP, LOGL_NOTICE, "lapd_to_ehlc returned != 0: %d.\n", rc);
LOGP(DL2TP, LOGL_NOTICE, "%s: lapd_to_ehlc returned != 0: %d.\n", channel->name, rc);
}
msgb_free(msg);