MINOR: server/bind: add support of new prefixes for addresses.
Since the internal function str2sa_range is used to addresses
for different objects ('server', 'bind' but also 'log' or
'nameserver') we notice that some combinations are missing.
"ip@" is introduced to authorize the prefix "dgram+ip@" or
"stream+ip@" which dectects automatically IP version but
specify dgram or stream.
"tcp@" was introduced and is an alias for "stream+ip@".
"tcp6" and "tcp4" are now aliases for "stream+ipv6@" and
"stream+ipv4@".
"uxst@" and "uxdg@" are now aliases for "stream+unix@" and
"dgram+unix@".
This patch also adds a complete section in documentation to
describe adresses and their prefixes.
diff --git a/src/tools.c b/src/tools.c
index 4924ad1..9cb4e89 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -930,11 +930,27 @@
abstract = 0;
ss.ss_family = AF_UNIX;
}
+ else if (strncmp(str2, "uxdg@", 5) == 0) {
+ str2 += 5;
+ abstract = 0;
+ ss.ss_family = AF_UNIX;
+ sock_type = ctrl_type = SOCK_DGRAM;
+ }
+ else if (strncmp(str2, "uxst@", 5) == 0) {
+ str2 += 5;
+ abstract = 0;
+ ss.ss_family = AF_UNIX;
+ sock_type = ctrl_type = SOCK_STREAM;
+ }
else if (strncmp(str2, "abns@", 5) == 0) {
str2 += 5;
abstract = 1;
ss.ss_family = AF_UNIX;
}
+ else if (strncmp(str2, "ip@", 3) == 0) {
+ str2 += 3;
+ ss.ss_family = AF_UNSPEC;
+ }
else if (strncmp(str2, "ipv4@", 5) == 0) {
str2 += 5;
ss.ss_family = AF_INET;
@@ -943,16 +959,31 @@
str2 += 5;
ss.ss_family = AF_INET6;
}
+ else if (strncmp(str2, "tcp4@", 5) == 0) {
+ str2 += 5;
+ ss.ss_family = AF_INET;
+ sock_type = ctrl_type = SOCK_STREAM;
+ }
else if (strncmp(str2, "udp4@", 5) == 0) {
str2 += 5;
ss.ss_family = AF_INET;
sock_type = ctrl_type = SOCK_DGRAM;
}
+ else if (strncmp(str2, "tcp6@", 5) == 0) {
+ str2 += 5;
+ ss.ss_family = AF_INET6;
+ sock_type = ctrl_type = SOCK_STREAM;
+ }
else if (strncmp(str2, "udp6@", 5) == 0) {
str2 += 5;
ss.ss_family = AF_INET6;
sock_type = ctrl_type = SOCK_DGRAM;
}
+ else if (strncmp(str2, "tcp@", 4) == 0) {
+ str2 += 4;
+ ss.ss_family = AF_UNSPEC;
+ sock_type = ctrl_type = SOCK_STREAM;
+ }
else if (strncmp(str2, "udp@", 4) == 0) {
str2 += 4;
ss.ss_family = AF_UNSPEC;