diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-02-11 21:01:59 +0100 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-02-12 00:12:48 +0400 |
commit | 0c0b233e8df9d98f41d0e761abfa54a1776272bd (patch) | |
tree | 93490bd4ca20f29c01ef5ea523010f09bc85c23d | |
parent | 4a12ea24f72c833e0294511d2a4a29788b119953 (diff) | |
download | accel-ppp-0c0b233e8df9d98f41d0e761abfa54a1776272bd.tar.gz accel-ppp-0c0b233e8df9d98f41d0e761abfa54a1776272bd.zip |
l2tp: Pass peer address as sockaddr in tunnel alloc.
Use a "struct sockaddr_in" pointer for passing the peer address to the
tunnel allocation function (instead of a "struct l2tp_packet_t *"). This
makes l2tp_tunnel_alloc() usable in situations where tunnel creation
doesn't happen in response to a peer request.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index bdfd9ff..eed750a 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -588,7 +588,7 @@ out_err: } static struct l2tp_conn_t *l2tp_tunnel_alloc(struct l2tp_serv_t *serv, - struct l2tp_packet_t *pack, + const struct sockaddr_in *peer, const struct sockaddr_in *host, uint32_t framing_cap, struct l2tp_attr_t *challenge) @@ -637,7 +637,7 @@ static struct l2tp_conn_t *l2tp_tunnel_alloc(struct l2tp_serv_t *serv, goto out_err; } - if (connect(conn->hnd.fd, (struct sockaddr *)&pack->addr, sizeof(pack->addr))) { + if (connect(conn->hnd.fd, (struct sockaddr *)peer, sizeof(*peer))) { log_error("l2tp: connect: %s\n", strerror(errno)); goto out_err; } @@ -672,7 +672,7 @@ static struct l2tp_conn_t *l2tp_tunnel_alloc(struct l2tp_serv_t *serv, goto out_err; } - memcpy(&conn->lac_addr, &pack->addr, sizeof(pack->addr)); + memcpy(&conn->lac_addr, peer, sizeof(*peer)); memcpy(&conn->lns_addr, host, sizeof(*host)); conn->framing_cap = framing_cap; @@ -1131,7 +1131,7 @@ static int l2tp_recv_SCCRQ(struct l2tp_serv_t *serv, struct l2tp_packet_t *pack, host_addr.sin_addr = pkt_info->ipi_addr; host_addr.sin_port = 0; - conn = l2tp_tunnel_alloc(serv, pack, &host_addr, + conn = l2tp_tunnel_alloc(serv, &pack->addr, &host_addr, framing_cap->val.uint32, challenge); if (conn == NULL) return -1; |