}
static int
-check_stream_prm(const struct tle_udp_stream_param *prm)
+check_stream_prm(const struct tle_udp_ctx *ctx,
+ const struct tle_udp_stream_param *prm)
{
if ((prm->local_addr.ss_family != AF_INET &&
prm->local_addr.ss_family != AF_INET6) ||
prm->local_addr.ss_family != prm->remote_addr.ss_family)
- return EINVAL;
+ return -EINVAL;
/* callback and event notifications mechanisms are mutually exclusive */
if ((prm->recv_ev != NULL && prm->recv_cb.func != NULL) ||
(prm->send_ev != NULL && prm->send_cb.func != NULL))
- return EINVAL;
+ return -EINVAL;
+
+ /* check does context support desired address family. */
+ if ((prm->local_addr.ss_family == AF_INET &&
+ ctx->prm.lookup4 == NULL) ||
+ (prm->local_addr.ss_family == AF_INET6 &&
+ ctx->prm.lookup6 == NULL))
+ return -EINVAL;
return 0;
}
const struct sockaddr_in *rin;
int32_t rc;
- if (ctx == NULL || prm == NULL || check_stream_prm(prm) != 0) {
+ if (ctx == NULL || prm == NULL || check_stream_prm(ctx, prm) != 0) {
rte_errno = EINVAL;
return NULL;
}