1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From dd103797da3a4bf8c662119b3ff717e0ca072cd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 12 Aug 2019 22:46:36 +0200
Subject: [PATCH] xiogetaddrinfo: support SOCK_RAW
The functions from xio-rawip.c call xiogetaddrinfo with this socktype.
Unfortunately, xiogetaddrinfo silently discards it.
For this reason IP-SENDTO function do not work with musl libc, e.g.
Alpine Linux. On these systems socat aborts with the following error
message:
socat - IP6-SENDTO:localhost:6
2019/08/12 22:48:34 socat[12846] E getaddrinfo("localhost", "NULL", {1,10,2,6}, {}): Unrecognized service
This patches fixes this issue.
---
xio-ip.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xio-ip.c b/xio-ip.c
index a2252b2..8aa414b 100644
--- a/xio-ip.c
+++ b/xio-ip.c
@@ -121,7 +121,7 @@ unsigned long res_opts() {
hostname.domain (fq hostname resolving to IPv4 or IPv6 address)
service: the port specification; may be numeric or symbolic
family: PF_INET, PF_INET6, or PF_UNSPEC permitting both
- socktype: SOCK_STREAM, SOCK_DGRAM
+ socktype: SOCK_STREAM, SOCK_DGRAM, SOCK_RAW
protocol: IPPROTO_UDP, IPPROTO_TCP
sau: an uninitialized storage for the resulting socket address
returns: STAT_OK, STAT_RETRYLATER
@@ -202,7 +202,8 @@ int xiogetaddrinfo(const char *node, const char *service,
if (node != NULL || service != NULL) {
struct addrinfo *record;
- if (socktype != SOCK_STREAM && socktype != SOCK_DGRAM) {
+ if (socktype != SOCK_STREAM && socktype != SOCK_DGRAM &&
+ socktype != SOCK_RAW) {
/* actual socket type value is not supported - fallback to a good one */
socktype = SOCK_DGRAM;
}
|