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[] = {
{ KNOT_ERROR, "General error." },
{ KNOT_ENOTRUNNING, "Resource is not running." },
{ KNOT_EPARSEFAIL, "Parser failed." },
{ KNOT_ENOIPV6, "IPv6 support disabled." },
{ KNOT_EEXPIRED, "Resource is expired." },
{ KNOT_EUPTODATE, "Zone is up-to-date." },
{ KNOT_EFEWDATA, "Not enough data to parse." },
......
......@@ -62,7 +62,6 @@ enum knot_error {
KNOT_ERROR = -10000, /*!< General error. */
KNOT_ENOTRUNNING, /*!< Resource is not running. */
KNOT_EPARSEFAIL, /*!< Parser fail. */
KNOT_ENOIPV6, /*!< No IPv6 support. */
KNOT_EEXPIRED, /*!< Resource is expired. */
KNOT_EUPTODATE, /*!< Zone is up-to-date. */
KNOT_EFEWDATA, /*!< Not enough data to parse. */
......
......@@ -17,181 +17,136 @@
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include "common/sockaddr.h"
#include "common/errcode.h"
#include "libknot/consts.h"
int sockaddr_init(sockaddr_t *addr, int af)
int sockaddr_len(const struct sockaddr_storage *ss)
{
/* Reset pointer. */
memset(addr, 0, sizeof(sockaddr_t));
/* Initialize address size. */
switch(af) {
switch(ss->ss_family) {
case AF_INET:
addr->len = sizeof(struct sockaddr_in);
addr->prefix = IPV4_PREFIXLEN;
break;
#ifndef DISABLE_IPV6
return sizeof(struct sockaddr_in);
case AF_INET6:
addr->len = sizeof(struct sockaddr_in6);
addr->prefix = IPV6_PREFIXLEN;
break;
#endif
return sizeof(struct sockaddr_in6);
case AF_UNIX:
return sizeof(struct sockaddr_un);
default:
return -1;
}
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 KNOT_EINVAL;
}
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) {
return -1;
}
/* 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;
if (ss == NULL || straddr == NULL) {
return KNOT_EINVAL;
}
/* Convert address. */
return inet_pton(family, addr, paddr);
}
/* Clear the structure and set family and port. */
memset(ss, 0, sizeof(struct sockaddr_storage));
ss->ss_family = family;
sockaddr_port_set(ss, port);
int sockaddr_setprefix(sockaddr_t *dst, int prefix)
{
if (dst == NULL || prefix < 0) {
return -1;
/* Initialize address depending on address family. */
if (family == AF_INET6) {
struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)ss;
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) {
return -1;
if (ss == NULL || buf == NULL) {
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. */
#ifndef DISABLE_IPV6
size_t minlen = INET6_ADDRSTRLEN;
#else
size_t minlen = INET_ADDRSTRLEN;
#endif
/* Check minimum length. */
if (size < minlen) {
return -1;
if (ret == NULL) {
return KNOT_ESPACE;
}
/* Convert. */
#ifdef DISABLE_IPV6
dst[0] = '\0';
#else
/* Load IPv6 addr if default. */
if (addr->len == sizeof(struct sockaddr_in6)) {
inet_ntop(AF_INET6, &addr->addr6.sin6_addr, dst, size);
}
#endif
/* Load IPv4 if set. */
if (addr->len == sizeof(struct sockaddr_in)) {
inet_ntop(AF_INET, &addr->addr4.sin_addr, dst, size);
/* Write separator and port. */
int port = sockaddr_port(ss);
if (port > 0) {
/* Check available space. */
size_t written = strlen(buf);
if (written + SOCKADDR_STRLEN_EXT > maxlen) {
return KNOT_ESPACE;
}
/* Write separator. */
buf[written] = '@';
written += 1;
/* 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) {
return -1;
if (ss == NULL) {
return KNOT_EINVAL;
}
switch(addr->len) {
/* IPv4 */
case sizeof(struct sockaddr_in):
return ntohs(addr->addr4.sin_port);
break;
/* IPv6 */
#ifndef DISABLE_IPV6
case sizeof(struct sockaddr_in6):
return ntohs(addr->addr6.sin6_port);
break;
#endif
/* N/A */
default:
return -1;
break;
if (ss->ss_family == AF_INET6) {
return ntohs(((struct sockaddr_in6 *)ss)->sin6_port);
} else if (ss->ss_family == AF_INET) {
return ntohs(((struct sockaddr_in *)ss)->sin_port);
} else {
return KNOT_EINVAL;
}
}
int sockaddr_family(const sockaddr_t *addr)
void sockaddr_port_set(struct sockaddr_storage *ss, uint16_t port)
{
switch(addr->len) {
case sizeof(struct sockaddr_in): return AF_INET; break;
#ifndef DISABLE_IPV6
case sizeof(struct sockaddr_in6): return AF_INET6; break;
#endif
default: return 0; break;
if (ss == NULL) {
return;
}
}
void sockaddr_prep(sockaddr_t *addr)
{
#ifndef DISABLE_IPV6
addr->len = sizeof(struct sockaddr_in6);
#else
addr->len = sizeof(struct sockaddr_in);
#endif
if (ss->ss_family == AF_INET6) {
((struct sockaddr_in6 *)ss)->sin6_port = htons(port);
} else if (ss->ss_family == AF_INET) {
((struct sockaddr_in *)ss)->sin_port = htons(port);
}
}
char *sockaddr_hostname(void)
......
......@@ -32,131 +32,76 @@
#define __POSIX_VISIBLE = 200112
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.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;
#include <stdint.h>
/* Subnet maximum prefix length. */
#define IPV4_PREFIXLEN 32
#define IPV6_PREFIXLEN 128
/*! \brief Maximum address length in string format. */
#ifdef DISABLE_IPV6
#define SOCKADDR_STRLEN INET_ADDRSTRLEN
#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);
/* Address string "address[@port]" maximum length. */
#define SOCKADDR_STRLEN_EXT (1 + 6) /* '@', 5 digits number, \0 */
#define SOCKADDR_STRLEN (sizeof(struct sockaddr_un) + SOCKADDR_STRLEN_EXT)
/*!
* \brief Copy socket address structure.
* \brief Calculate current structure length based on address family.
*
* \param dst Target address structure.
* \param src Source address structure.
* \param ss Socket address storage.
*
* \retval 0 on success.
* \retval -1 on error.
* \return number of bytes or error code
*/
int sockaddr_copy(sockaddr_t *dst, const sockaddr_t *src);
int sockaddr_len(const struct sockaddr_storage *ss);
/*!
* \brief Set address and port.
*
* \param dst Target address structure.
* \param ss Socket address storage.
* \param family Address family.
* \param addr IP address in string format.
* \param straddr IP address in string format.
* \param port Port.
*
* \retval 0 if addr is not valid address in string format.
* \retval positive value in case of success.
* \retval -1 on error.
* \see inet_pton(3)
* \return KNOT_EOK on success or an error code
*/
int sockaddr_set(sockaddr_t *dst, int family, const char* addr, 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);
int sockaddr_set(struct sockaddr_storage *ss, int family, const char *straddr, int port);
/*!
* \brief Return string representation of socket address.
*
* \param addr Socket address structure.
* \param dst Destination for string representation.
* \param size Maximum number of written bytes.
* \note String format: <address>[@<port>], f.e. '127.0.0.1@53'
*
* \param ss Socket address storage.
* \param buf Destination for string representation.
* \param maxlen Maximum number of written bytes.
*
* \retval 0 on success.
* \retval -1 on invalid parameters.
* \return EOK on success, error code on failure
*/
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.
*
* \param addr Socket address structure.
* \param ss Socket address storage.
*
* \retval Port number on success.
* \retval -1 on errors.
* \return port number or error code
*/
int sockaddr_portnum(const sockaddr_t *addr);
int sockaddr_port(const struct sockaddr_storage *ss);
/*!
* \brief Return socket address family.
* \param addr Socket address structure.
* \return address family
*/
int sockaddr_family(const sockaddr_t *addr);
/*!
* \brief Prepare to maximum largest size.
* \return KNOT_EOK
* \brief Set port number.
*
* \param ss Socket address storage.
*
*/
void sockaddr_prep(sockaddr_t *addr);
void sockaddr_port_set(struct sockaddr_storage *ss, uint16_t port);
/*!
* \brief Get host FQDN address.
* \retval hostname string
* \retval NULL on error
*
* \return hostname string or NULL
*/
char *sockaddr_hostname(void);
......
......@@ -237,11 +237,6 @@ include BEGIN(include);
}
\[({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)];
yytext[strlen(yytext)-1] = '\0';
if (inet_pton(AF_INET6, yytext+1, buf)) {
......@@ -249,22 +244,15 @@ include BEGIN(include);
return IPA6;
}
cf_error(yyscanner, "Invalid IPv6 address.");
#endif
}
({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)];
if (inet_pton(AF_INET6, yytext, buf)) {
lval.t = strdup(yytext);
return IPA6;
}
cf_error(yyscanner, "Invalid IPv6 address.");
#endif
}
[0][x]{HEXA}+ {
......
......@@ -111,7 +111,6 @@ static void conf_start_remote(void *scanner, char *remote)
memset(this_remote, 0, sizeof(conf_iface_t));
this_remote->name = remote;
add_tail(&new_config->remotes, &this_remote->n);
sockaddr_init(&this_remote->via, -1);
++new_config->remotes_count;
}
......
......@@ -434,14 +434,12 @@ static int conf_process(conf_t *conf)
if (conf->gid < 0) conf->gid = getgid();
/* Build remote control ACL. */
sockaddr_t addr;
conf_remote_t *r = NULL;
WALK_LIST(r, conf->ctl.allow) {
conf_iface_t *i = r->remote;
sockaddr_init(&addr, -1);
sockaddr_set(&addr, i->family, i->address, 0);
sockaddr_setprefix(&addr, i->prefix);
acl_insert(conf->ctl.acl, &addr, i->key);
struct sockaddr_storage ss;
sockaddr_set(&ss, i->family, i->address, 0);
acl_insert(conf->ctl.acl, &ss, i->prefix, i->key);
}
return ret;
......
......@@ -72,7 +72,7 @@ typedef struct conf_iface_t {
int port; /*!< Port number for this interface */
int family; /*!< Address family. */
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;
/*!
......
......@@ -450,7 +450,7 @@ int remote_poll(int r)
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);
if (c < 0) {
......@@ -605,11 +605,11 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
}
/* Initialize remote party address. */
sockaddr_t addr;
sockaddr_prep(&addr);
struct sockaddr_storage ss;
memset(&ss, 0, sizeof(struct sockaddr_storage));
/* 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) {
dbg_server("remote: couldn't receive query = %d\n", client);
knot_pkt_free(&pkt);
......@@ -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) {
/* Check ACL list. */
char straddr[SOCKADDR_STRLEN];
sockaddr_tostr(&addr, straddr, sizeof(straddr));
int rport = sockaddr_portnum(&addr);
char addr_str[SOCKADDR_STRLEN] = {0};
sockaddr_tostr(&ss, addr_str, sizeof(addr_str));
knot_tsig_key_t *tsig_key = NULL;
const knot_dname_t *tsig_name = NULL;
if (pkt->tsig_rr) {
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;
uint16_t ts_trc = 0;
uint64_t ts_tmsigned = 0;
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",
straddr, rport);
addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......@@ -649,9 +648,9 @@ int remote_process(server_t *s, conf_iface_t *ctl_if, int sock,
/* Check TSIG. */
if (tsig_key) {
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",
straddr, rport);
addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......@@ -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,
&ts_trc, &ts_tmsigned);
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",
straddr, rport);
addr_str);
remote_senderr(client, pkt->wire, pkt->size);
ret = KNOT_EACCES;
goto finish;
......
......@@ -76,7 +76,7 @@ int remote_poll(int r);
* \return client TCP socket if success.
* \return KNOT_ECONNREFUSED if fails to receive command.
*/
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);
/*!
* \brief Parse a RC command.
......
......@@ -337,7 +337,7 @@ int main(int argc, char **argv)
pthread_sigmask(SIG_BLOCK, &sa.sa_mask, NULL);
/* Bind to control interface. */
uint8_t buf[SOCKET_MTU_SZ];
uint8_t buf[KNOT_WIRE_MAX_PKTSIZE];
size_t buflen = sizeof(buf);
int remote = -1;
if (conf()->ctl.iface != NULL) {
......
......@@ -223,7 +223,7 @@ int process_query_err(knot_pkt_t *pkt, knot_process_t *ctx)
bool process_query_acl_check(acl_t *acl, struct query_data *qdata)
{
knot_pkt_t *query = qdata->query;
const sockaddr_t *query_source = &qdata->param->query_source;
struct sockaddr_storage *query_source = qdata->param->query_source;
const knot_dname_t *key_name = NULL;
knot_tsig_algorithm_t key_alg = KNOT_TSIG_ALG_NULL;
......@@ -407,7 +407,7 @@ static int ratelimit_apply(int state, knot_pkt_t *pkt, knot_process_t *ctx)
if (!EMPTY_LIST(qdata->wildcards)) {
rrl_rq.flags = KNOT_PF_WILDCARD;
}
if (rrl_query(server->rrl, &qdata->param->query_source,
if (rrl_query(server->rrl, qdata->param->query_source,
&rrl_rq, qdata->zone) == KNOT_EOK) {
/* Rate limiting not applied. */
return state;
......
......@@ -38,23 +38,21 @@ extern const knot_process_module_t _process_query;
/*! \brief Query processing logging common base. */
#define NS_PROC_LOG(severity, qdata, what, msg, ...) do { \
sockaddr_t *addr = &(qdata)->param->query_source; \
char addr_str[SOCKADDR_STRLEN] = {0}; \
sockaddr_tostr(addr, addr_str, sizeof(addr_str)); \
sockaddr_tostr((qdata)->param->query_source, addr_str, sizeof(addr_str)); \
char *zone_str = knot_dname_to_str(knot_pkt_qname((qdata)->query)); \
log_msg(LOG_SERVER, severity, what msg "\n", \
zone_str, \
addr_str, sockaddr_portnum(addr), ##__VA_ARGS__); \
zone_str, addr_str, ##__VA_ARGS__); \
free(zone_str); \
} while (0)
/*! \brief Query logging common base. */
#define QUERY_LOG(severity, qdata, what, msg...) \
NS_PROC_LOG(severity, qdata, what " of '%s' from '%s@%d': ", msg)
NS_PROC_LOG(severity, qdata, what " of '%s' from '%s': ", msg)
/*! \brief Answer logging common base. */
#define ANSWER_LOG(severity, qdata, what, msg...) \
NS_PROC_LOG(severity, qdata, what " of '%s' to '%s@%d': ", msg)
NS_PROC_LOG(severity, qdata, what " of '%s' to '%s': ", msg)
/* Query processing specific flags. */
enum process_query_flag {
......@@ -68,8 +66,8 @@ enum process_query_flag {
/* Module load parameters. */
struct process_query_param {
uint16_t proc_flags;
sockaddr_t query_source;
int query_socket;
struct sockaddr_storage *query_source;
server_t *server;
};
......
......@@ -12,7 +12,7 @@
/* Forward decls. */
static int zones_process_update_auth(zone_t *zone, knot_pkt_t *query,
knot_rcode_t *rcode, const sockaddr_t *addr,
knot_rcode_t *rcode, const struct sockaddr_storage *addr,
knot_tsig_key_t *tsig_key);
/* AXFR-specific logging (internal, expects 'qdata' variable set). */
......@@ -42,7 +42,7 @@ static int update_forward(knot_pkt_t *pkt, struct query_data *qdata)
/* Copy query originator data. */
rq->fwd_src_fd = qdata->param->query_socket;
memcpy(&rq->fwd_addr, &qdata->param->query_source, sizeof(sockaddr_t));
memcpy(&rq->fwd_addr, qdata->param->query_source, sizeof(struct sockaddr_storage));
rq->packet_nr = knot_wire_get_id(query->wire);
/* Duplicate query to keep it in memory during forwarding. */
......@@ -101,7 +101,7 @@ static int update_process(knot_pkt_t *resp, struct query_data *qdata)
knot_rcode_t rcode = qdata->rcode;
ret = zones_process_update_auth((zone_t *)qdata->zone, qdata->query,
&rcode,
&qdata->param->query_source,
qdata->param->query_source,
qdata->sign.tsig_key);
qdata->rcode = rcode;
return ret;
......@@ -254,7 +254,7 @@ static int replan_zone_sign_after_ddns(zone_t *zone, uint32_t refresh_at)
* \retval error if not.
*/
static int zones_process_update_auth(zone_t *zone, knot_pkt_t *query,
knot_rcode_t *rcode, const sockaddr_t *addr,
knot_rcode_t *rcode, const struct sockaddr_storage *addr,
knot_tsig_key_t *tsig_key)
{
assert(zone);
......
......@@ -156,7 +156,7 @@ static int rrl_clsname(char *dst, size_t maxlen, uint8_t cls,
return knot_dname_to_wire((uint8_t *)dst, dn, maxlen);
}
static int rrl_classify(char *dst, size_t maxlen, const sockaddr_t *a,
static int rrl_classify(char *dst, size_t maxlen, const struct sockaddr_storage *a,
rrl_req_t *p, const zone_t *z, uint32_t seed)
{
if (!dst || !p || !a || maxlen == 0) {
......@@ -170,10 +170,12 @@ static int rrl_classify(char *dst, size_t maxlen, const sockaddr_t *a,
/* Address (in network byteorder, adjust masks). */
<