Commit 783e34ff authored by Marek Vavrusa's avatar Marek Vavrusa

server: removed custom sockaddr_t in favor of built-in sockaddr_storage

parent bc21f9cc
...@@ -43,7 +43,6 @@ const error_table_t knot_error_msgs[] = { ...@@ -43,7 +43,6 @@ const error_table_t knot_error_msgs[] = {
{ KNOT_ERROR, "General error." }, { KNOT_ERROR, "General error." },
{ KNOT_ENOTRUNNING, "Resource is not running." }, { KNOT_ENOTRUNNING, "Resource is not running." },
{ KNOT_EPARSEFAIL, "Parser failed." }, { KNOT_EPARSEFAIL, "Parser failed." },
{ KNOT_ENOIPV6, "IPv6 support disabled." },
{ KNOT_EEXPIRED, "Resource is expired." }, { KNOT_EEXPIRED, "Resource is expired." },
{ KNOT_EUPTODATE, "Zone is up-to-date." }, { KNOT_EUPTODATE, "Zone is up-to-date." },
{ KNOT_EFEWDATA, "Not enough data to parse." }, { KNOT_EFEWDATA, "Not enough data to parse." },
......
...@@ -62,7 +62,6 @@ enum knot_error { ...@@ -62,7 +62,6 @@ enum knot_error {
KNOT_ERROR = -10000, /*!< General error. */ KNOT_ERROR = -10000, /*!< General error. */
KNOT_ENOTRUNNING, /*!< Resource is not running. */ KNOT_ENOTRUNNING, /*!< Resource is not running. */
KNOT_EPARSEFAIL, /*!< Parser fail. */ KNOT_EPARSEFAIL, /*!< Parser fail. */
KNOT_ENOIPV6, /*!< No IPv6 support. */
KNOT_EEXPIRED, /*!< Resource is expired. */ KNOT_EEXPIRED, /*!< Resource is expired. */
KNOT_EUPTODATE, /*!< Zone is up-to-date. */ KNOT_EUPTODATE, /*!< Zone is up-to-date. */
KNOT_EFEWDATA, /*!< Not enough data to parse. */ KNOT_EFEWDATA, /*!< Not enough data to parse. */
......
...@@ -17,181 +17,136 @@ ...@@ -17,181 +17,136 @@
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <unistd.h> #include <unistd.h>
#include "common/sockaddr.h" #include "common/sockaddr.h"
#include "common/errcode.h"
#include "libknot/consts.h" #include "libknot/consts.h"
int sockaddr_init(sockaddr_t *addr, int af) int sockaddr_len(const struct sockaddr_storage *ss)
{ {
/* Reset pointer. */ switch(ss->ss_family) {
memset(addr, 0, sizeof(sockaddr_t));
/* Initialize address size. */
switch(af) {
case AF_INET: case AF_INET:
addr->len = sizeof(struct sockaddr_in); return sizeof(struct sockaddr_in);
addr->prefix = IPV4_PREFIXLEN;
break;
#ifndef DISABLE_IPV6
case AF_INET6: case AF_INET6:
addr->len = sizeof(struct sockaddr_in6); return sizeof(struct sockaddr_in6);
addr->prefix = IPV6_PREFIXLEN; case AF_UNIX:
break; return sizeof(struct sockaddr_un);
#endif
default: default:
return -1; return KNOT_EINVAL;
}
return 0;
}
int sockaddr_isvalid(sockaddr_t *addr)
{
return addr && (addr->len > 0);
}
int sockaddr_copy(sockaddr_t *dst, const sockaddr_t *src)
{
if (memcpy(dst, src, sizeof(sockaddr_t)) != NULL) {
return 0;
} }
return -1;
} }
int sockaddr_set(sockaddr_t *dst, int family, const char* addr, int port) int sockaddr_set(struct sockaddr_storage *ss, int family, const char *straddr, int port)
{ {
if (!dst || !addr || port < 0) { if (ss == NULL || straddr == NULL) {
return -1; return KNOT_EINVAL;
}
/* Initialize. */
dst->len = 0;
sockaddr_init(dst, family);
/* Initialize depending on address family. */
void *paddr = 0;
switch(family) {
case AF_INET:
dst->addr4.sin_family = family;
dst->addr4.sin_port = htons(port);
paddr = &dst->addr4.sin_addr;
dst->addr4.sin_addr.s_addr = INADDR_ANY;
dst->prefix = IPV4_PREFIXLEN;
break;
#ifndef DISABLE_IPV6
case AF_INET6:
dst->addr6.sin6_family = family;
dst->addr6.sin6_port = htons(port);
paddr = &dst->addr6.sin6_addr;
memcpy(&dst->addr6.sin6_addr,
&in6addr_any, sizeof(in6addr_any));
dst->prefix = IPV6_PREFIXLEN;
break;
#endif
default:
return -1;
} }
/* Convert address. */ /* Clear the structure and set family and port. */
return inet_pton(family, addr, paddr); memset(ss, 0, sizeof(struct sockaddr_storage));
} ss->ss_family = family;
sockaddr_port_set(ss, port);
int sockaddr_setprefix(sockaddr_t *dst, int prefix) /* Initialize address depending on address family. */
{ if (family == AF_INET6) {
if (dst == NULL || prefix < 0) { struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)ss;
return -1; if (inet_pton(family, straddr, &ipv6->sin6_addr) < 1) {
return KNOT_ERROR;
}
return KNOT_EOK;
} else if (family == AF_INET) {
struct sockaddr_in *ipv4 = (struct sockaddr_in *)ss;
if (inet_pton(family, straddr, &ipv4->sin_addr) < 1) {
return KNOT_ERROR;
}
return KNOT_EOK;
} else if (family == AF_UNIX) {
struct sockaddr_un *un = (struct sockaddr_un *)ss;
if (strlen(straddr) > sizeof(un->sun_path) - 1) {
return KNOT_ESPACE;
}
strcpy(un->sun_path, straddr);
return KNOT_EOK;
} }
return dst->prefix = prefix; return KNOT_EINVAL;
} }
int sockaddr_tostr(const sockaddr_t *addr, char *dst, size_t size) int sockaddr_tostr(const struct sockaddr_storage *ss, char *buf, size_t maxlen)
{ {
if (!addr || !dst || size == 0) { if (ss == NULL || buf == NULL) {
return -1; return KNOT_EINVAL;
}
const char* ret = NULL;
/* Convert network address string. */
if (ss->ss_family == AF_INET6) {
const struct sockaddr_in6 *s = (const struct sockaddr_in6 *)ss;
ret = inet_ntop(ss->ss_family, &s->sin6_addr, buf, maxlen);
} else if (ss->ss_family == AF_INET) {
const struct sockaddr_in *s = (const struct sockaddr_in *)ss;
ret = inet_ntop(ss->ss_family, &s->sin_addr, buf, maxlen);
} else if (ss->ss_family == AF_UNIX) {
const struct sockaddr_un *s = (const struct sockaddr_un *)ss;
if (strlen(s->sun_path) > maxlen - 1) {
return KNOT_ESPACE;
}
ret = strcpy(buf, s->sun_path);
} else {
return KNOT_EINVAL;
} }
/* Check unsupported IPv6. */ if (ret == NULL) {
#ifndef DISABLE_IPV6 return KNOT_ESPACE;
size_t minlen = INET6_ADDRSTRLEN;
#else
size_t minlen = INET_ADDRSTRLEN;
#endif
/* Check minimum length. */
if (size < minlen) {
return -1;
} }
/* Convert. */ /* Write separator and port. */
#ifdef DISABLE_IPV6 int port = sockaddr_port(ss);
dst[0] = '\0'; if (port > 0) {
#else /* Check available space. */
/* Load IPv6 addr if default. */ size_t written = strlen(buf);
if (addr->len == sizeof(struct sockaddr_in6)) { if (written + SOCKADDR_STRLEN_EXT > maxlen) {
inet_ntop(AF_INET6, &addr->addr6.sin6_addr, dst, size); return KNOT_ESPACE;
} }
#endif /* Write separator. */
/* Load IPv4 if set. */ buf[written] = '@';
if (addr->len == sizeof(struct sockaddr_in)) { written += 1;
inet_ntop(AF_INET, &addr->addr4.sin_addr, dst, size); /* Write port number. */
sprintf(&buf[written], "%d", port);
} }
return 0; return KNOT_ERROR;
} }
int sockaddr_portnum(const sockaddr_t *addr) int sockaddr_port(const struct sockaddr_storage *ss)
{ {
if (!addr) { if (ss == NULL) {
return -1; return KNOT_EINVAL;
} }
switch(addr->len) { if (ss->ss_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)ss)->sin6_port);
/* IPv4 */ } else if (ss->ss_family == AF_INET) {
case sizeof(struct sockaddr_in): return ntohs(((struct sockaddr_in *)ss)->sin_port);
return ntohs(addr->addr4.sin_port); } else {
break; return KNOT_EINVAL;
/* IPv6 */
#ifndef DISABLE_IPV6
case sizeof(struct sockaddr_in6):
return ntohs(addr->addr6.sin6_port);
break;
#endif
/* N/A */
default:
return -1;
break;
} }
} }
int sockaddr_family(const sockaddr_t *addr) void sockaddr_port_set(struct sockaddr_storage *ss, uint16_t port)
{ {
switch(addr->len) { if (ss == NULL) {
case sizeof(struct sockaddr_in): return AF_INET; break; return;
#ifndef DISABLE_IPV6
case sizeof(struct sockaddr_in6): return AF_INET6; break;
#endif
default: return 0; break;
} }
}
void sockaddr_prep(sockaddr_t *addr) if (ss->ss_family == AF_INET6) {
{ ((struct sockaddr_in6 *)ss)->sin6_port = htons(port);
#ifndef DISABLE_IPV6 } else if (ss->ss_family == AF_INET) {
addr->len = sizeof(struct sockaddr_in6); ((struct sockaddr_in *)ss)->sin_port = htons(port);
#else }
addr->len = sizeof(struct sockaddr_in);
#endif
} }
char *sockaddr_hostname(void) char *sockaddr_hostname(void)
......
...@@ -32,131 +32,76 @@ ...@@ -32,131 +32,76 @@
#define __POSIX_VISIBLE = 200112 #define __POSIX_VISIBLE = 200112
#endif #endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <stdint.h>
/*! \brief Universal socket address. */
typedef struct sockaddr_t {
union {
struct sockaddr_in addr4; /*!< IPv4 sockaddr. */
#ifndef DISABLE_IPV6
struct sockaddr_in6 addr6; /*!< IPv6 sockaddr. */
#endif
};
socklen_t len; /*!< Length of used sockaddr. */
short prefix; /*!< Address prefix. */
} sockaddr_t;
/* Subnet maximum prefix length. */ /* Subnet maximum prefix length. */
#define IPV4_PREFIXLEN 32 #define IPV4_PREFIXLEN 32
#define IPV6_PREFIXLEN 128 #define IPV6_PREFIXLEN 128
/*! \brief Maximum address length in string format. */ /* Address string "address[@port]" maximum length. */
#ifdef DISABLE_IPV6 #define SOCKADDR_STRLEN_EXT (1 + 6) /* '@', 5 digits number, \0 */
#define SOCKADDR_STRLEN INET_ADDRSTRLEN #define SOCKADDR_STRLEN (sizeof(struct sockaddr_un) + SOCKADDR_STRLEN_EXT)
#else
#define SOCKADDR_STRLEN INET6_ADDRSTRLEN
#endif
/*!
* \brief Initialize address structure.
*
* Members ptr and len will be initialized to correct address family.
*
* \param addr Socket address structure.
* \param af Requested address family.
*
* \retval 0 on success.
* \retval -1 on unsupported address family (probably INET6).
*/
int sockaddr_init(sockaddr_t *addr, int af);
/*!
* \brief Return true value if sockaddr is valid.
*
* \param addr Socket address structure.
*
* \retval true on succes.
* \retval false otherwise.
*/
int sockaddr_isvalid(sockaddr_t *addr);
/*! /*!
* \brief Copy socket address structure. * \brief Calculate current structure length based on address family.
* *
* \param dst Target address structure. * \param ss Socket address storage.
* \param src Source address structure.
* *
* \retval 0 on success. * \return number of bytes or error code
* \retval -1 on error.
*/ */
int sockaddr_copy(sockaddr_t *dst, const sockaddr_t *src); int sockaddr_len(const struct sockaddr_storage *ss);
/*! /*!
* \brief Set address and port. * \brief Set address and port.
* *
* \param dst Target address structure. * \param ss Socket address storage.
* \param family Address family. * \param family Address family.
* \param addr IP address in string format. * \param straddr IP address in string format.
* \param port Port. * \param port Port.
* *
* \retval 0 if addr is not valid address in string format. * \return KNOT_EOK on success or an error code
* \retval positive value in case of success.
* \retval -1 on error.
* \see inet_pton(3)
*/ */
int sockaddr_set(sockaddr_t *dst, int family, const char* addr, int port); int sockaddr_set(struct sockaddr_storage *ss, int family, const char *straddr, int port);
/*!
* \brief Set address prefix.
*
* \param dst Target address structure.
* \param prefix Prefix.
*
* \retval 0 if success.
* \retval -1 on error.
*/
int sockaddr_setprefix(sockaddr_t *dst, int prefix);
/*! /*!
* \brief Return string representation of socket address. * \brief Return string representation of socket address.
* *
* \param addr Socket address structure. * \note String format: <address>[@<port>], f.e. '127.0.0.1@53'
* \param dst Destination for string representation. *
* \param size Maximum number of written bytes. * \param ss Socket address storage.
* \param buf Destination for string representation.
* \param maxlen Maximum number of written bytes.
* *
* \retval 0 on success. * \return EOK on success, error code on failure
* \retval -1 on invalid parameters.
*/ */
int sockaddr_tostr(const sockaddr_t *addr, char *dst, size_t size); int sockaddr_tostr(const struct sockaddr_storage *ss, char *buf, size_t maxlen);
/*! /*!
* \brief Return port number from address. * \brief Return port number from address.
* *
* \param addr Socket address structure. * \param ss Socket address storage.
* *
* \retval Port number on success. * \return port number or error code
* \retval -1 on errors.
*/ */
int sockaddr_portnum(const sockaddr_t *addr); int sockaddr_port(const struct sockaddr_storage *ss);
/*! /*!
* \brief Return socket address family. * \brief Set port number.
* \param addr Socket address structure. *
* \return address family * \param ss Socket address storage.
*/ *
int sockaddr_family(const sockaddr_t *addr);
/*!
* \brief Prepare to maximum largest size.
* \return KNOT_EOK
*/ */
void sockaddr_prep(sockaddr_t *addr); void sockaddr_port_set(struct sockaddr_storage *ss, uint16_t port);
/*! /*!
* \brief Get host FQDN address. * \brief Get host FQDN address.
* \retval hostname string *
* \retval NULL on error * \return hostname string or NULL
*/ */
char *sockaddr_hostname(void); char *sockaddr_hostname(void);
......
...@@ -237,11 +237,6 @@ include BEGIN(include); ...@@ -237,11 +237,6 @@ include BEGIN(include);
} }
\[({HEXA}*::|({HEXA}*:){3,})({HEXA}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+)\] { \[({HEXA}*::|({HEXA}*:){3,})({HEXA}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+)\] {
#ifdef DISABLE_IPV6
lval.t = strdup(yytext);
cf_error(yyscanner, "IPv6 address support not compiled.");
return TEXT;
#else
unsigned char buf[sizeof(struct in6_addr)]; unsigned char buf[sizeof(struct in6_addr)];
yytext[strlen(yytext)-1] = '\0'; yytext[strlen(yytext)-1] = '\0';
if (inet_pton(AF_INET6, yytext+1, buf)) { if (inet_pton(AF_INET6, yytext+1, buf)) {
...@@ -249,22 +244,15 @@ include BEGIN(include); ...@@ -249,22 +244,15 @@ include BEGIN(include);
return IPA6; return IPA6;
} }
cf_error(yyscanner, "Invalid IPv6 address."); cf_error(yyscanner, "Invalid IPv6 address.");
#endif
} }
({HEXA}*::|({HEXA}*:){3,})({HEXA}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+) { ({HEXA}*::|({HEXA}*:){3,})({HEXA}*|{DIGIT}+\.{DIGIT}+\.{DIGIT}+\.{DIGIT}+) {
#ifdef DISABLE_IPV6
lval.t = strdup(yytext);
cf_error(yyscanner, "IPv6 address support not compiled.");
return TEXT;
#else
unsigned char buf[sizeof(struct in6_addr)]; unsigned char buf[sizeof(struct in6_addr)];
if (inet_pton(AF_INET6, yytext, buf)) { if (inet_pton(AF_INET6, yytext, buf)) {
lval.t = strdup(yytext); lval.t = strdup(yytext);
return IPA6; return IPA6;
} }
cf_error(yyscanner, "Invalid IPv6 address."); cf_error(yyscanner, "Invalid IPv6 address.");
#endif
} }
[0][x]{HEXA}+ { [0][x]{HEXA}+ {
......
...@@ -111,7 +111,6 @@ static void conf_start_remote(void *scanner, char *remote) ...@@ -111,7 +111,6 @@ static void conf_start_remote(void *scanner, char *remote)
memset(this_remote, 0, sizeof(conf_iface_t)); memset(this_remote, 0, sizeof(conf_iface_t));
this_remote->name = remote; this_remote->name = remote;
add_tail(&new_config->remotes, &this_remote->n); add_tail(&new_config->remotes, &this_remote->n);
sockaddr_init(&this_remote->via, -1);
++new_config->remotes_count; ++new_config->remotes_count;
} }
......
...@@ -434,14 +434,12 @@ static int conf_process(conf_t *conf) ...@@ -434,14 +434,12 @@ static int conf_process(conf_t *conf)
if (conf->gid < 0) conf->gid = getgid(); if (conf->gid < 0) conf->gid = getgid();
/* Build remote control ACL. */ /* Build remote control ACL. */
sockaddr_t addr;
conf_remote_t *r = NULL; conf_remote_t *r = NULL;
WALK_LIST(r, conf->ctl.allow) { WALK_LIST(r, conf->ctl.allow) {
conf_iface_t *i = r->remote; conf_iface_t *i = r->remote;
sockaddr_init(&addr, -1); struct sockaddr_storage ss;
sockaddr_set(&addr, i->family, i->address, 0); sockaddr_set(&ss, i->family, i->address, 0);
sockaddr_setprefix(&addr, i->prefix); acl_insert(conf->ctl.acl, &ss, i->prefix, i->key);
acl_insert(conf->ctl.acl, &addr, i->key);
} }
return ret; return ret;
......
...@@ -72,7 +72,7 @@ typedef struct conf_iface_t { ...@@ -72,7 +72,7 @@ typedef struct conf_iface_t {
int port; /*!< Port number for this interface */ int port; /*!< Port number for this interface */
int family; /*!< Address family. */ int family; /*!< Address family. */
knot_tsig_key_t *key; /*!< TSIG key (only valid for remotes). */ knot_tsig_key_t *key; /*!< TSIG key (only valid for remotes). */
sockaddr_t via; /*!< Used for remotes to specify qry endpoint.*/ struct sockaddr_storage via; /*!< Used for remotes to specify qry endpoint.*/
} conf_iface_t; } conf_iface_t;
/*! /*!
......
...@@ -450,7 +450,7 @@ int remote_poll(int r) ...@@ -450,7 +450,7 @@ int remote_poll(int r)
return fdset_pselect(r + 1, &rfds, NULL, NULL, NULL, NULL); return fdset_pselect(r + 1, &rfds, NULL, NULL, NULL, NULL);
} }
int remote_recv(int r, sockaddr_t *a, uint8_t* buf, size_t *buflen) int remote_recv(int r, struct sockaddr *a, uint8_t* buf, size_t *buflen)
{ {
int c = tcp_accept(r); int c = tcp_accept(r);
if (c < 0) { if (c < 0) {
...@@ -605,11 +605,11 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock, ...@@ -605,11 +605,11 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
} }
/* Initialize remote party address. */ /* Initialize remote party address. */
sockaddr_t addr; struct sockaddr_storage ss;
sockaddr_prep(&addr); memset(&ss, 0, sizeof(struct sockaddr_storage));
/* Accept incoming connection and read packet. */ /* Accept incoming connection and read packet. */
int client = remote_recv(sock, &addr, pkt->wire, &buflen); int client = remote_recv(sock, (struct sockaddr *)&ss, pkt->wire, &buflen);
if (client < 0) { if (client < 0) {
dbg_server("remote: couldn't receive query = %d\n", client); dbg_server("remote: couldn't receive query = %d\n", client);
knot_pkt_free(&pkt); knot_pkt_free(&pkt);
...@@ -623,22 +623,21 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock, ...@@ -623,22 +623,21 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
if (ret == KNOT_EOK && ctl_if->family != AF_UNIX) { if (ret == KNOT_EOK && ctl_if->family != AF_UNIX) {
/* Check ACL list. */ /* Check ACL list. */
char straddr[SOCKADDR_STRLEN]; char addr_str[SOCKADDR_STRLEN] = {0};
sockaddr_tostr(&addr, straddr, sizeof(straddr)); sockaddr_tostr(&ss, addr_str, sizeof(addr_str));
int rport = sockaddr_portnum(&addr);
knot_tsig_key_t *tsig_key = NULL; knot_tsig_key_t *tsig_key = NULL;
const knot_dname_t *tsig_name = NULL; const knot_dname_t *tsig_name = NULL;
if (pkt->tsig_rr) { if (pkt->tsig_rr) {
tsig_name = pkt->tsig_rr->owner; tsig_name = pkt->tsig_rr->owner;
} }
acl_match_t *match = acl_find(conf()->ctl.acl, &addr, tsig_name); acl_match_t *match = acl_find(conf()->ctl.acl, &ss, tsig_name);
knot_rcode_t ts_rc = 0; knot_rcode_t ts_rc = 0;
uint16_t ts_trc = 0; uint16_t ts_trc = 0;
uint64_t ts_tmsigned = 0; uint64_t ts_tmsigned = 0;
if (match == NULL) { if (match == NULL) {
log_server_warning("Denied remote control for '%s@%d' " log_server_warning("Denied remote control for '%s' "
"(doesn't match ACL).\n", "(doesn't match ACL).\n",
straddr, rport); addr_str);
remote_senderr(client, pkt->wire, pkt->size); remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES; ret = KNOT_EACCES;
goto finish; goto finish;
...@@ -649,9 +648,9 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock, ...@@ -649,9 +648,9 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
/* Check TSIG. */ /* Check TSIG. */
if (tsig_key) { if (tsig_key) {
if (pkt->tsig_rr == NULL) { if (pkt->tsig_rr == NULL) {
log_server_warning("Denied remote control for '%s@%d' " log_server_warning("Denied remote control for '%s' "
"(key required).\n", "(key required).\n",
straddr, rport); addr_str);
remote_senderr(client, pkt->wire, pkt->size); remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES; ret = KNOT_EACCES;
goto finish; goto finish;
...@@ -659,9 +658,9 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock, ...@@ -659,9 +658,9 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
ret = zones_verify_tsig_query(pkt, tsig_key, &ts_rc, ret = zones_verify_tsig_query(pkt, tsig_key, &ts_rc,
&ts_trc, &ts_tmsigned); &ts_trc, &ts_tmsigned);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
log_server_warning("Denied remote control for '%s@%d' " log_server_warning("Denied remote control for '%s' "
"(key verification failed).\n", "(key verification failed).\n",
straddr, rport); addr_str);
remote_senderr(client, pkt->wire, pkt->size); remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES; ret = KNOT_EACCES;
goto finish; goto finish;
......
...@@ -76,7 +76,7 @@ int remote_poll(int r); ...@@ -76,7 +76,7 @@ int remote_poll(int r);
* \return client TCP socket if success. * \return client TCP socket if success.
* \return KNOT_ECONNREFUSED if fails to receive command. * \return KNOT_ECONNREFUSED if fails to receive command.