diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2013-02-11 21:03:15 +0100 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-02-12 00:12:48 +0400 |
commit | d44c07282f354b09fa3628674d963415b362cb85 (patch) | |
tree | d31f1359f5aa9dc931665b7b07b91d729374e9d7 /accel-pppd/ctrl | |
parent | 947076a2d9cd9b338c70b43d30e277974046525b (diff) | |
download | accel-ppp-d44c07282f354b09fa3628674d963415b362cb85.tar.gz accel-ppp-d44c07282f354b09fa3628674d963415b362cb85.zip |
l2tp: Send L2TP messages with sendto()
Send L2TP messages to the host set in the addr field of l2tp_packet_t,
instead of relying on the file descriptor's connection state. This
will allow the file descriptor to be disconnected (allowing it to
wait for a message from an arbitrary source port) while still being
able to retransmit previous L2TP messages.
This possibility is necessary for initiating tunnel establishment: the
initial SCCRQ is sent to the peer on port 1701, but the peer may reply
with an arbitrary source port. The socket thus needs to be disconnected
to be able to receive the peer's SCCRP. But in the mean time, the
initial SCCRQ may need to be retransmitted (if no answer is received
from the peer after a given amount of time). Hence the need for sending
L2TP messages over unconnected sockets.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c index d6eb66c..c9de3c7 100644 --- a/accel-pppd/ctrl/l2tp/packet.c +++ b/accel-pppd/ctrl/l2tp/packet.c @@ -374,8 +374,8 @@ int l2tp_packet_send(int sock, struct l2tp_packet_t *pack) pack->hdr.length = htons(len); memcpy(buf, &pack->hdr, sizeof(pack->hdr)); - n = write(sock, buf, ntohs(pack->hdr.length)); - + n = sendto(sock, buf, ntohs(pack->hdr.length), 0, + &pack->addr, sizeof(pack->addr)); mempool_free(buf); if (n < 0) { |