diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2015-11-18 15:26:45 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2015-11-18 17:43:32 +0100 |
commit | cf8a5f016ff609d7facf2453a8c585f935a46b5c (patch) | |
tree | 7ed4922df9c15dbf8f6959a81604963408d4c6a7 /debian | |
parent | d1b590c5e1dd1c743f2dcbbf7cb0298a85f69e5f (diff) | |
download | vyos-strongswan-cf8a5f016ff609d7facf2453a8c585f935a46b5c.tar.gz vyos-strongswan-cf8a5f016ff609d7facf2453a8c585f935a46b5c.zip |
0001-socket-dynamic-Refactor-setting-source-address-when- dropped
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/patches/0001-socket-dynamic-Refactor-setting-source-address-when-.patch | 139 | ||||
-rw-r--r-- | debian/patches/series | 1 |
3 files changed, 2 insertions, 141 deletions
diff --git a/debian/changelog b/debian/changelog index b0359b0da..346f5c7c4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,8 @@ strongswan (5.3.4-1) UNRELEASED; urgency=medium * New upstream release. * debian/patches: - 03_systemd-service refreshed for new upstream release. - - 0001-socket-default-Refactor-setting-source-address-when- dropped, + - 0001-socket-default-Refactor-setting-source-address-when-, + 0001-socket-dynamic-Refactor-setting-source-address-when- dropped, included upstream. -- Yves-Alexis Perez <corsac@debian.org> Wed, 18 Nov 2015 15:19:49 +0100 diff --git a/debian/patches/0001-socket-dynamic-Refactor-setting-source-address-when-.patch b/debian/patches/0001-socket-dynamic-Refactor-setting-source-address-when-.patch deleted file mode 100644 index 3b74c6b70..000000000 --- a/debian/patches/0001-socket-dynamic-Refactor-setting-source-address-when-.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 9e8b4aa5c86775e72c2fd3bd764cba896351914a Mon Sep 17 00:00:00 2001 -From: Tobias Brunner <tobias@strongswan.org> -Date: Tue, 3 Nov 2015 15:35:16 +0100 -Subject: [PATCH] socket-dynamic: Refactor setting source address when sending - messages - -Basically the same change as the one for the socket-default plugin. ---- - .../plugins/socket_dynamic/socket_dynamic_socket.c | 94 ++++++++++++++-------- - 1 file changed, 62 insertions(+), 32 deletions(-) - -diff --git a/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c b/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c -index b82a69e..a032134 100644 ---- a/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c -+++ b/src/libcharon/plugins/socket_dynamic/socket_dynamic_socket.c -@@ -527,6 +527,62 @@ static dynsock_t *find_socket(private_socket_dynamic_socket_t *this, - return skt; - } - -+/** -+ * Generic function to send a message. -+ */ -+static ssize_t send_msg_generic(int skt, struct msghdr *msg) -+{ -+ return sendmsg(skt, msg, 0); -+} -+ -+/** -+ * Send a message with the IPv4 source address set. -+ */ -+static ssize_t send_msg_v4(int skt, struct msghdr *msg, host_t *src) -+{ -+ char buf[CMSG_SPACE(sizeof(struct in_pktinfo))] = {}; -+ struct cmsghdr *cmsg; -+ struct in_addr *addr; -+ struct in_pktinfo *pktinfo; -+ struct sockaddr_in *sin; -+ -+ msg->msg_control = buf; -+ msg->msg_controllen = sizeof(buf); -+ cmsg = CMSG_FIRSTHDR(msg); -+ cmsg->cmsg_level = SOL_IP; -+ cmsg->cmsg_type = IP_PKTINFO; -+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo)); -+ -+ pktinfo = (struct in_pktinfo*)CMSG_DATA(cmsg); -+ addr = &pktinfo->ipi_spec_dst; -+ -+ sin = (struct sockaddr_in*)src->get_sockaddr(src); -+ memcpy(addr, &sin->sin_addr, sizeof(struct in_addr)); -+ return send_msg_generic(skt, msg); -+} -+ -+/** -+ * Send a message with the IPv6 source address set. -+ */ -+static ssize_t send_msg_v6(int skt, struct msghdr *msg, host_t *src) -+{ -+ char buf[CMSG_SPACE(sizeof(struct in6_pktinfo))] = {}; -+ struct cmsghdr *cmsg; -+ struct in6_pktinfo *pktinfo; -+ struct sockaddr_in6 *sin; -+ -+ msg->msg_control = buf; -+ msg->msg_controllen = sizeof(buf); -+ cmsg = CMSG_FIRSTHDR(msg); -+ cmsg->cmsg_level = SOL_IPV6; -+ cmsg->cmsg_type = IPV6_PKTINFO; -+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); -+ pktinfo = (struct in6_pktinfo*)CMSG_DATA(cmsg); -+ sin = (struct sockaddr_in6*)src->get_sockaddr(src); -+ memcpy(&pktinfo->ipi6_addr, &sin->sin6_addr, sizeof(struct in6_addr)); -+ return send_msg_generic(skt, msg); -+} -+ - METHOD(socket_t, sender, status_t, - private_socket_dynamic_socket_t *this, packet_t *packet) - { -@@ -536,7 +592,6 @@ METHOD(socket_t, sender, status_t, - ssize_t len; - chunk_t data; - struct msghdr msg; -- struct cmsghdr *cmsg; - struct iovec iov; - - src = packet->get_source(packet); -@@ -564,43 +619,18 @@ METHOD(socket_t, sender, status_t, - { - if (family == AF_INET) - { -- struct in_addr *addr; -- struct sockaddr_in *sin; -- char buf[CMSG_SPACE(sizeof(struct in_pktinfo))]; -- struct in_pktinfo *pktinfo; -- -- memset(buf, 0, sizeof(buf)); -- msg.msg_control = buf; -- msg.msg_controllen = sizeof(buf); -- cmsg = CMSG_FIRSTHDR(&msg); -- cmsg->cmsg_level = SOL_IP; -- cmsg->cmsg_type = IP_PKTINFO; -- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo)); -- pktinfo = (struct in_pktinfo*)CMSG_DATA(cmsg); -- addr = &pktinfo->ipi_spec_dst; -- sin = (struct sockaddr_in*)src->get_sockaddr(src); -- memcpy(addr, &sin->sin_addr, sizeof(struct in_addr)); -+ len = send_msg_v4(skt->fd, &msg, src); - } - else - { -- char buf[CMSG_SPACE(sizeof(struct in6_pktinfo))]; -- struct in6_pktinfo *pktinfo; -- struct sockaddr_in6 *sin; -- -- memset(buf, 0, sizeof(buf)); -- msg.msg_control = buf; -- msg.msg_controllen = sizeof(buf); -- cmsg = CMSG_FIRSTHDR(&msg); -- cmsg->cmsg_level = SOL_IPV6; -- cmsg->cmsg_type = IPV6_PKTINFO; -- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); -- pktinfo = (struct in6_pktinfo*)CMSG_DATA(cmsg); -- sin = (struct sockaddr_in6*)src->get_sockaddr(src); -- memcpy(&pktinfo->ipi6_addr, &sin->sin6_addr, sizeof(struct in6_addr)); -+ len = send_msg_v6(skt->fd, &msg, src); - } - } -+ else -+ { -+ len = send_msg_generic(skt->fd, &msg); -+ } - -- len = sendmsg(skt->fd, &msg, 0); - if (len != data.len) - { - DBG1(DBG_NET, "error writing to socket: %s", strerror(errno)); --- -2.6.2 - diff --git a/debian/patches/series b/debian/patches/series index 89a951fae..68c6f4c33 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,4 @@ 01_fix-manpages.patch 03_systemd-service.patch 04_disable-libtls-tests.patch -0001-socket-dynamic-Refactor-setting-source-address-when-.patch CVE-2015-8023_eap_mschapv2_state.patch |