uint32_t timeout = HTTP_RANGE_DEFAULT_TIMEOUT;
if (ConfGet("app-layer.protocols.http.byterange.memcap", &str) == 1) {
if (ParseSizeStringU64(str, &memcap) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"memcap value cannot be deduced: %s,"
" resetting to default",
str);
if (ConfGet("app-layer.protocols.http.byterange.timeout", &str) == 1) {
size_t slen = strlen(str);
if (slen > UINT16_MAX || StringParseUint32(&timeout, 10, (uint16_t)slen, str) <= 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"timeout value cannot be deduced: %s,"
" resetting to default",
str);
SCLogDebug("LIBHTP adding ipv6 server %s at %s: %p",
s->name, pval->val, cfg_prec->cfg);
if (SCRadixAddKeyIPV6String(pval->val, tree, cfg_prec) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP failed to "
- "add ipv6 server %s, ignoring", pval->val);
+ SCLogWarning(SC_EINVAL,
+ "LIBHTP failed to "
+ "add ipv6 server %s, ignoring",
+ pval->val);
}
} else {
SCLogDebug("LIBHTP adding ipv4 server %s at %s: %p",
s->name, pval->val, cfg_prec->cfg);
if (SCRadixAddKeyIPV4String(pval->val, tree, cfg_prec) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP failed "
- "to add ipv4 server %s, ignoring",
- pval->val);
+ SCLogWarning(SC_EINVAL,
+ "LIBHTP failed "
+ "to add ipv4 server %s, ignoring",
+ pval->val);
}
} /* else - if (strchr(pval->val, ':') != NULL) */
} /* TAILQ_FOREACH(pval, &p->head, next) */
SCLogDebug("LIBHTP default: %s=%s (%d)", p->name, p->val,
personality);
if (htp_config_set_server_personality(cfg_prec->cfg, personality) == HTP_ERROR){
- SCLogWarning(SC_ERR_INVALID_VALUE, "LIBHTP Failed adding "
- "personality \"%s\", ignoring", p->val);
+ SCLogWarning(SC_EINVAL,
+ "LIBHTP Failed adding "
+ "personality \"%s\", ignoring",
+ p->val);
} else {
SCLogDebug("LIBHTP personality set to %s",
HTPLookupPersonalityString(personality));
uint32_t range;
if (StringParseU32RangeCheck(&range, 10, 0,
(const char *)p->val, 0, 100) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for randomize"
- "-inspection-range setting from conf file - \"%s\"."
- " It should be a valid integer less than or equal to 100."
- " Killing engine",
- p->val);
+ SCLogError(SC_EINVAL,
+ "Invalid value for randomize"
+ "-inspection-range setting from conf file - \"%s\"."
+ " It should be a valid integer less than or equal to 100."
+ " Killing engine",
+ p->val);
exit(EXIT_FAILURE);
}
cfg_prec->randomize_range = range;
const char *interval = ConfNodeLookupChildValue(stats, "interval");
if (interval != NULL)
if (StringParseUint32(&stats_tts, 10, 0, interval) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "interval: \"%s\". Resetting to %d.", interval,
- STATS_MGMTT_TTS);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "interval: \"%s\". Resetting to %d.",
+ interval, STATS_MGMTT_TTS);
stats_tts = STATS_MGMTT_TTS;
}
const char *str = NULL;
if (ConfGet("datasets.defaults.memcap", &str) == 1) {
if (ParseSizeStringU64(str, memcap) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"memcap value cannot be deduced: %s,"
" resetting to default",
str);
}
if (ConfGet("datasets.defaults.hashsize", &str) == 1) {
if (ParseSizeStringU32(str, hashsize) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"hashsize value cannot be deduced: %s,"
" resetting to default",
str);
ConfNode *set_memcap = ConfNodeLookupChild(iter, "memcap");
if (set_memcap) {
if (ParseSizeStringU64(set_memcap->val, &memcap) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"memcap value cannot be"
" deduced: %s, resetting to default",
set_memcap->val);
ConfNode *set_hashsize = ConfNodeLookupChild(iter, "hashsize");
if (set_hashsize) {
if (ParseSizeStringU32(set_hashsize->val, &hashsize) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"hashsize value cannot be"
" deduced: %s, resetting to default",
set_hashsize->val);
intmax_t value = 0;
if (ConfGetInt("decoder.max-layers", &value) == 1) {
if (value < 0 || value > UINT8_MAX) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for decoder.max-layers");
+ SCLogWarning(SC_EINVAL, "Invalid value for decoder.max-layers");
} else {
decoder_max_layers = (uint8_t)value;
}
intmax_t max = 0;
if (ConfGetInt("packet-alert-max", &max) == 1) {
if (max <= 0 || max > UINT8_MAX) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Invalid value for packet-alert-max, default value set instead");
+ SCLogWarning(
+ SC_EINVAL, "Invalid value for packet-alert-max, default value set instead");
} else {
packet_alert_max = (uint16_t)max;
}
if (strchr(host_ip_range, ':') != NULL) {
SCLogDebug("adding ipv6 host %s", host_ip_range);
if (SCRadixAddKeyIPV6String(host_ip_range, defrag_tree, (void *)user_data) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "failed to add ipv6 host %s", host_ip_range);
+ SCLogWarning(SC_EINVAL, "failed to add ipv6 host %s", host_ip_range);
}
} else {
SCLogDebug("adding ipv4 host %s", host_ip_range);
if (SCRadixAddKeyIPV4String(host_ip_range, defrag_tree, (void *)user_data) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "failed to add ipv4 host %s", host_ip_range);
+ SCLogWarning(SC_EINVAL, "failed to add ipv4 host %s", host_ip_range);
}
}
}
DetectAsn1Data *ad = rs_detect_asn1_parse(asn1str);
if (ad == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed asn1 argument: %s",
- asn1str);
+ SCLogError(SC_EINVAL, "Malformed asn1 argument: %s", asn1str);
}
return ad;
/* Number of bytes */
if (StringParseUint32(&nbytes, 10, (uint16_t)strlen(args[0]), args[0]) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed number of bytes: %s", optstr);
+ SCLogError(SC_EINVAL, "Malformed number of bytes: %s", optstr);
goto error;
}
goto error;
} else {
if (StringParseInt32(&data->offset, 0, (uint16_t)strlen(args[1]), args[1]) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed offset: %s", optstr);
+ SCLogError(SC_EINVAL, "Malformed offset: %s", optstr);
goto error;
}
}
} else if (strncasecmp("multiplier ", args[i], 11) == 0) {
if (StringParseUint32(
&data->multiplier, 10, (uint16_t)strlen(args[i]) - 11, args[i] + 11) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed multiplier: %s", optstr);
+ SCLogError(SC_EINVAL, "Malformed multiplier: %s", optstr);
goto error;
}
} else if (strncasecmp("post_offset ", args[i], 12) == 0) {
if (StringParseInt32(&data->post_offset, 10, (uint16_t)strlen(args[i]) - 12,
args[i] + 12) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed post_offset: %s", optstr);
+ SCLogError(SC_EINVAL, "Malformed post_offset: %s", optstr);
goto error;
}
} else if (strcasecmp("dce", args[i]) == 0) {
data->flags |= DETECT_BYTEJUMP_DCE;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "Unknown option: \"%s\"", args[i]);
+ SCLogError(SC_EINVAL, "Unknown option: \"%s\"", args[i]);
goto error;
}
}
* "01777777777777777777777" = 0xffffffffffffffff
*/
if (nbytes > 23) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 23 bytes "
- "with \"string\": %s", optstr);
+ SCLogError(SC_EINVAL,
+ "Cannot test more than 23 bytes "
+ "with \"string\": %s",
+ optstr);
goto error;
}
} else {
if (nbytes > 8) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 8 bytes "
- "without \"string\": %s\n", optstr);
+ SCLogError(SC_EINVAL,
+ "Cannot test more than 8 bytes "
+ "without \"string\": %s\n",
+ optstr);
goto error;
}
if (data->base != DETECT_BYTEJUMP_BASE_UNSET) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot use a base "
- "without \"string\": %s", optstr);
+ SCLogError(SC_EINVAL,
+ "Cannot use a base "
+ "without \"string\": %s",
+ optstr);
goto error;
}
}
/* Number of bytes */
if (StringParseUint32(&nbytes, 10, 0, args[0]) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed number of bytes: %s", str_ptr);
+ SCLogError(SC_EINVAL, "Malformed number of bytes: %s", str_ptr);
goto error;
}
goto error;
} else {
if (ByteExtractStringUint64(&data->value, 0, 0, test_value) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed value: %s", test_value);
+ SCLogError(SC_EINVAL, "Malformed value: %s", test_value);
goto error;
}
}
goto error;
} else {
if (StringParseInt32(&data->offset, 0, 0, data_offset) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed offset: %s", data_offset);
+ SCLogError(SC_EINVAL, "Malformed offset: %s", data_offset);
goto error;
}
}
* "01777777777777777777777" = 0xffffffffffffffff
*/
if (nbytes > 23) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 23 bytes with \"string\": %s",
- optstr);
+ SCLogError(SC_EINVAL, "Cannot test more than 23 bytes with \"string\": %s", optstr);
goto error;
}
} else {
if (nbytes > 8) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot test more than 8 bytes without \"string\": %s",
- optstr);
+ SCLogError(SC_EINVAL, "Cannot test more than 8 bytes without \"string\": %s", optstr);
goto error;
}
if (data->base != DETECT_BYTETEST_BASE_UNSET) {
- SCLogError(SC_ERR_INVALID_VALUE, "Cannot use a base without \"string\": %s", optstr);
+ SCLogError(SC_EINVAL, "Cannot use a base without \"string\": %s", optstr);
goto error;
}
}
if (bitmask_index != -1 && data->flags & DETECT_BYTETEST_BITMASK) {
if (ByteExtractStringUint32(&data->bitmask, 0, 0, args[bitmask_index]+strlen("bitmask")) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed bitmask value: %s", args[bitmask_index]+strlen("bitmask"));
+ SCLogError(SC_EINVAL, "Malformed bitmask value: %s",
+ args[bitmask_index] + strlen("bitmask"));
goto error;
}
/* determine how many trailing 0's are in the bitmask. This will be used
}
if (strlen(e) >= CLASSTYPE_NAME_MAX_LEN) {
- SCLogError(SC_ERR_INVALID_VALUE, "classtype '%s' is too big: max %d",
- rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
+ SCLogError(
+ SC_EINVAL, "classtype '%s' is too big: max %d", rawstr, CLASSTYPE_NAME_MAX_LEN - 1);
return -1;
}
(void)strlcpy(out, e, outsize);
}
if (strcmp(key, "memcap") == 0) {
if (ParseSizeStringU64(val, memcap) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"invalid value for memcap: %s,"
" resetting to default",
val);
}
if (strcmp(key, "hashsize") == 0) {
if (ParseSizeStringU32(val, hashsize) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"invalid value for hashsize: %s,"
" resetting to default",
val);
}
if (strcmp(key, "memcap") == 0) {
if (ParseSizeStringU64(val, memcap) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"invalid value for memcap: %s,"
" resetting to default",
val);
}
if (strcmp(key, "hashsize") == 0) {
if (ParseSizeStringU32(val, hashsize) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"invalid value for hashsize: %s,"
" resetting to default",
val);
}
if (df->count == 0 || df->seconds == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "found an invalid value");
+ SCLogError(SC_EINVAL, "found an invalid value");
goto error;
}
* cast to non-const as replace writes to it. */
det_ctx->replist = DetectReplaceAddToList(det_ctx->replist, (uint8_t *)found, cd);
} else {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Can't modify payload without packet");
+ SCLogWarning(SC_EINVAL, "Can't modify payload without packet");
}
}
#ifndef BUILD_HYPERSCAN
if ((strcmp(mpm_algo, "hs") == 0)) {
- FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for mpm-algo is "
- "not compiled into Suricata.");
+ FatalError(SC_EINVAL, "Hyperscan (hs) support for mpm-algo is "
+ "not compiled into Suricata.");
}
#endif
}
break;
case TRACK_RULE:
default:
- SCLogError(SC_ERR_INVALID_VALUE,
- "track mode %d is not supported", td->track);
+ SCLogError(SC_EINVAL, "track mode %d is not supported", td->track);
break;
}
if (m == NULL)
}
/* case TYPE_SUPPRESS: is not handled here */
default:
- SCLogError(SC_ERR_INVALID_VALUE, "type %d is not supported", td->type);
+ SCLogError(SC_EINVAL, "type %d is not supported", td->type);
}
return ret;
}
if (insp_recursion_limit != NULL) {
if (StringParseInt32(&de_ctx->inspection_recursion_limit, 10,
0, (const char *)insp_recursion_limit) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "detect-engine.inspection-recursion-limit: %s "
- "resetting to %d", insp_recursion_limit,
- DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "detect-engine.inspection-recursion-limit: %s "
+ "resetting to %d",
+ insp_recursion_limit, DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT);
de_ctx->inspection_recursion_limit =
DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT;
}
int vlanbool = 0;
if ((ConfGetBool("vlan.use-for-tracking", &vlanbool)) == 1 && vlanbool == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "vlan tracking is disabled, "
- "can't use multi-detect selector 'vlan'");
+ SCLogError(SC_EINVAL, "vlan tracking is disabled, "
+ "can't use multi-detect selector 'vlan'");
SCMutexUnlock(&master->lock);
goto error;
}
}
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "unknown value %s "
- "multi-detect.selector", handler);
+ SCLogError(SC_EINVAL,
+ "unknown value %s "
+ "multi-detect.selector",
+ handler);
SCMutexUnlock(&master->lock);
goto error;
}
}
fd->flags |= DETECT_FLOW_FLAG_ONLY_FRAG;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "invalid flow option \"%s\"", args[i]);
+ SCLogError(SC_EINVAL, "invalid flow option \"%s\"", args[i]);
goto error;
}
}
if (args[1] == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "invalid value");
+ SCLogError(SC_EINVAL, "invalid value");
goto error;
}
ret = DetectParsePcreExec(&parse_regex, idstr, 0, 0);
if (ret < 1 || ret > 3) {
- SCLogError(SC_ERR_INVALID_VALUE, "invalid id option '%s'. The id option "
- "value must be in the range %u - %u",
- idstr, DETECT_IPID_MIN, DETECT_IPID_MAX);
+ SCLogError(SC_EINVAL,
+ "invalid id option '%s'. The id option "
+ "value must be in the range %u - %u",
+ idstr, DETECT_IPID_MIN, DETECT_IPID_MAX);
return NULL;
}
/* ok, fill the id data */
if (StringParseUint16(&temp, 10, 0, (const char *)tmp_str) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "invalid id option '%s'", tmp_str);
+ SCLogError(SC_EINVAL, "invalid id option '%s'", tmp_str);
return NULL;
}
if (!isdigit((unsigned char)*(args[1]))) {
uint8_t proto;
if (!SCGetProtoByName(args[1], &proto)) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unknown protocol name: \"%s\"", str_ptr);
+ SCLogError(SC_EINVAL, "Unknown protocol name: \"%s\"", str_ptr);
goto error;
}
data->proto = proto;
}
else {
if (StringParseUint8(&data->proto, 10, 0, args[1]) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Malformed protocol number: %s",
- str_ptr);
+ SCLogError(SC_EINVAL, "Malformed protocol number: %s", str_ptr);
goto error;
}
}
} else {
if (StringParseUint16(&idad->dataat, 10,
strlen(args[0]), args[0]) < 0 ) {
- SCLogError(SC_ERR_INVALID_VALUE, "isdataat out of range");
+ SCLogError(SC_EINVAL, "isdataat out of range");
SCFree(idad);
idad = NULL;
goto error;
if (strcmp(k, "retval") == 0) {
int val;
if (StringParseInt32(&val, 10, 0, (const char *)v) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
- "for \"retval\" from LUA return table: '%s'", v);
+ SCLogError(SC_EINVAL,
+ "Invalid value "
+ "for \"retval\" from LUA return table: '%s'",
+ v);
ret = 0;
}
else if (val == 1) {
int val;
if (StringParseInt32(&val, 10, 0,
(const char *)v) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
- "for \"retval\" from LUA return table: '%s'", v);
+ SCLogError(SC_EINVAL,
+ "Invalid value "
+ "for \"retval\" from LUA return table: '%s'",
+ v);
ret = 0;
}
else if (val == 1) {
int val;
if (StringParseInt32(&val, 10, 0,
(const char *)v) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value "
- "for \"retval\" from LUA return table: '%s'", v);
+ SCLogError(SC_EINVAL,
+ "Invalid value "
+ "for \"retval\" from LUA return table: '%s'",
+ v);
ret = 0;
}
else if (val == 1) {
}
if (strcmp(flagv+offset, "username") == 0) {
if (de->username != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->username = fs_to_set;
} else if (strcmp(flagv+offset, "password") == 0) {
if (de->password != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->password = fs_to_set;
} else if (strcmp(flagv+offset, "will") == 0) {
if (de->will != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->will = fs_to_set;
} else if (strcmp(flagv+offset, "will_retain") == 0) {
if (de->will_retain != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->will_retain = fs_to_set;
} else if (strcmp(flagv+offset, "clean_session") == 0) {
if (de->clean_session != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->clean_session = fs_to_set;
}
if (strcmp(flagv+offset, "dup") == 0) {
if (de->dup != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->dup = fs_to_set;
} else if (strcmp(flagv+offset, "retain") == 0) {
if (de->retain != MQTT_DONT_CARE) {
- SCLogError(SC_ERR_INVALID_VALUE, "duplicate flag definition: %s", flagv);
+ SCLogError(SC_EINVAL, "duplicate flag definition: %s", flagv);
goto error;
}
de->retain = fs_to_set;
static int DetectNoalertSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr)
{
if (nullstr != NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "nocase has no value");
+ SCLogError(SC_EINVAL, "nocase has no value");
return -1;
}
int ret = -1;
if (nullstr != NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "nocase has value");
+ SCLogError(SC_EINVAL, "nocase has value");
goto end;
}
SCEnter();
if (nullstr != NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "prefilter has value");
+ SCLogError(SC_EINVAL, "prefilter has value");
SCReturnInt(-1);
}
SCEnter();
if (nullstr != NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "rawbytes has no value");
+ SCLogError(SC_EINVAL, "rawbytes has no value");
SCReturnInt(-1);
}
uint16_t len = 0;
if (s->init_data->negated) {
- SCLogError(SC_ERR_INVALID_VALUE, "Can't negate replacement string: %s",
- replacestr);
+ SCLogError(SC_EINVAL, "Can't negate replacement string: %s", replacestr);
return -1;
}
break;
}
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "invalid rpc option %s",rpcstr);
+ SCLogError(SC_EINVAL, "invalid rpc option %s", rpcstr);
goto error;
}
}
tmp_str++;
}
if (tmp_str[0] == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid empty value");
+ SCLogError(SC_EINVAL, "Invalid empty value");
goto error;
}
// iterate every version separated by comma
if (tmp_len == strlen(ssl_version_keywords[i].word) &&
strncasecmp(ssl_version_keywords[i].word, tmp_str, tmp_len) == 0) {
if (ssl->data[ssl_version_keywords[i].index].ver != 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid duplicate value");
+ SCLogError(SC_EINVAL, "Invalid duplicate value");
goto error;
}
ssl->data[ssl_version_keywords[i].index].ver = ssl_version_keywords[i].value;
}
}
if (!is_keyword) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid unknown value");
+ SCLogError(SC_EINVAL, "Invalid unknown value");
goto error;
}
if (found == 0) {
found |= 1 << neg;
} else if (found != 1 << neg) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value mixing negative and positive forms");
+ SCLogError(SC_EINVAL, "Invalid value mixing negative and positive forms");
goto error;
}
} else if (strcasecmp("host", str_ptr) == 0) {
td.type = DETECT_TAG_TYPE_HOST;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument type. Must be session or host (%s)", tagstr);
+ SCLogError(SC_EINVAL, "Invalid argument type. Must be session or host (%s)", tagstr);
goto error;
}
pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
/* count */
if (StringParseUint32(&td.count, 10, strlen(str_ptr),
str_ptr) <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument for count. Must be a value in the range of 0 to %"PRIu32" (%s)", UINT32_MAX, tagstr);
+ SCLogError(SC_EINVAL,
+ "Invalid argument for count. Must be a value in the range of 0 to %" PRIu32
+ " (%s)",
+ UINT32_MAX, tagstr);
goto error;
}
} else if (strcasecmp("bytes", str_ptr) == 0) {
td.metric = DETECT_TAG_METRIC_BYTES;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument metric. Must be one of \"seconds\", \"packets\" or \"bytes\" (%s)", tagstr);
+ SCLogError(SC_EINVAL,
+ "Invalid argument metric. Must be one of \"seconds\", \"packets\" or \"bytes\" "
+ "(%s)",
+ tagstr);
goto error;
}
} else if (strcasecmp("dst", str_ptr) == 0) {
td.direction = DETECT_TAG_DIR_DST;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid argument direction. Must be one of \"src\" or \"dst\" (only valid for tag host type, not sessions) (%s)", tagstr);
+ SCLogError(SC_EINVAL,
+ "Invalid argument direction. Must be one of \"src\" or \"dst\" (only valid "
+ "for tag host type, not sessions) (%s)",
+ tagstr);
goto error;
}
if (td.type != DETECT_TAG_TYPE_HOST) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Argument direction doesn't make sense for type \"session\" (%s [%"PRIu8"])", tagstr, td.type);
+ SCLogWarning(SC_EINVAL,
+ "Argument direction doesn't make sense for type \"session\" (%s [%" PRIu8
+ "])",
+ tagstr, td.type);
}
pcre2_substring_free((PCRE2_UCHAR *)str_ptr);
}
s->flags |= SIG_FLAG_DEST_IS_TARGET;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "only 'src_ip' and 'dest_ip' are supported as target value");
+ SCLogError(SC_EINVAL, "only 'src_ip' and 'dest_ip' are supported as target value");
return -1;
}
return 0;
temp = (uint16_t)strtol(tmp_str, NULL, 0);
tls->flags |= DETECT_TLS_VERSION_FLAG_RAW;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value");
+ SCLogError(SC_EINVAL, "Invalid value");
goto error;
}
}
SCLogDebug("expire_str %s", expire_str);
if (StringParseUint32(&expire, 10, 0, (const char *)expire_str) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for "
- "expire: \"%s\"", expire_str);
+ SCLogError(SC_EINVAL,
+ "Invalid value for "
+ "expire: \"%s\"",
+ expire_str);
return -1;
}
if (expire == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "expire must be bigger than 0");
+ SCLogError(SC_EINVAL, "expire must be bigger than 0");
return -1;
}
SCLogDebug("expire %d", expire);
if (val <= 100 && val >= 1) {
flow_config.emergency_recovery = (uint8_t)val;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "flow.emergency-recovery must be in the range of "
- "1 and 100 (as percentage)");
+ SCLogError(SC_EINVAL, "flow.emergency-recovery must be in the range of "
+ "1 and 100 (as percentage)");
flow_config.emergency_recovery = FLOW_DEFAULT_EMERGENCY_RECOVERY;
}
} else {
break;
#endif
default:
- SCLogError(SC_ERR_INVALID_VALUE,
- "Invalid flow state: %d, contact developers",
- flow_state);
+ SCLogError(SC_EINVAL, "Invalid flow state: %d, contact developers", flow_state);
}
}
SCLogDebug("adding ipv6 host %s", ip);
if (SCRadixAddKeyIPV6String(ip, cidr_ctx->srepIPV6_tree[cat], (void *)user_data) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "failed to add ipv6 host %s", ip);
+ SCLogWarning(SC_EINVAL, "failed to add ipv6 host %s", ip);
}
} else {
SCLogDebug("adding ipv4 host %s", ip);
if (SCRadixAddKeyIPV4String(ip, cidr_ctx->srepIPV4_tree[cat], (void *)user_data) == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "failed to add ipv4 host %s", ip);
+ SCLogWarning(SC_EINVAL, "failed to add ipv4 host %s", ip);
}
}
}
aconf->threads = 0;
} else {
if (StringParseInt32(&aconf->threads, 10, 0, (const char *)threadsstr) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid number of "
- "threads, resetting to default");
+ SCLogWarning(SC_EINVAL, "Invalid number of "
+ "threads, resetting to default");
aconf->threads = 0;
}
}
aconf->cluster_id = (uint16_t)(cluster_id_auto++);
} else {
if (StringParseUint16(&aconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid cluster_id, resetting to 0");
+ SCLogWarning(SC_EINVAL, "Invalid cluster_id, resetting to 0");
aconf->cluster_id = 0;
}
SCLogDebug("Going to use cluster-id %" PRIu16, aconf->cluster_id);
&aconf->ebpf_lb_fd,
&aconf->ebpf_t_config);
if (ret != 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Error when loading eBPF lb file");
+ SCLogWarning(SC_EINVAL, "Error when loading eBPF lb file");
}
}
#else
&aconf->ebpf_filter_fd,
&aconf->ebpf_t_config);
if (ret != 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Error when loading eBPF filter file");
+ SCLogWarning(SC_EINVAL, "Error when loading eBPF filter file");
}
#else
SCLogError(SC_ERR_UNIMPLEMENTED, "eBPF support is not build-in");
aconf->xdp_mode = XDP_FLAGS_HW_MODE;
aconf->ebpf_t_config.flags |= EBPF_XDP_HW_MODE;
} else {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Invalid xdp-mode value: '%s'", xdp_mode);
+ SCLogWarning(SC_EINVAL, "Invalid xdp-mode value: '%s'", xdp_mode);
}
}
SCLogInfo("Loaded pinned maps from sysfs");
break;
case -1:
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Error when loading XDP filter file");
+ SCLogWarning(SC_EINVAL, "Error when loading XDP filter file");
break;
case 0:
ret = EBPFSetupXDP(aconf->iface, aconf->xdp_filter_fd, aconf->xdp_mode);
if (ret != 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Error when setting up XDP");
+ SCLogWarning(SC_EINVAL, "Error when setting up XDP");
} else {
/* Try to get the xdp-cpu-redirect key */
const char *cpuset;
SCLogConfig("Setting up CPU map XDP");
ConfNode *node = ConfGetChildWithDefault(if_root, if_default, "xdp-cpu-redirect");
if (node == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Previously found node has disappeared");
+ SCLogError(SC_EINVAL, "Previously found node has disappeared");
} else {
EBPFBuildCPUSet(node, aconf->iface);
}
if ((ConfGetChildValueIntWithDefault(if_root, if_default, "block-size", &value)) == 1) {
if (value % getpagesize()) {
- SCLogError(SC_ERR_INVALID_VALUE, "Block-size must be a multiple of pagesize.");
+ SCLogError(SC_EINVAL, "Block-size must be a multiple of pagesize.");
} else {
aconf->block_size = value;
}
for (ldev = 0; ldev < nlive; ldev++) {
const char *live_dev = LiveGetDeviceName(ldev);
if (live_dev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
const char *copymodestr = NULL;
if (if_root == NULL) {
if (if_default == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = if_default;
for (ldev = 0; ldev < nlive; ldev++) {
const char *live_dev = LiveGetDeviceName(ldev);
if (live_dev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = ConfNodeLookupKeyValue(af_packet_node, "interface", live_dev);
if (if_root == NULL) {
if (if_default == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = if_default;
int retval;
if (entry_str == NULL || entry_str[0] == '\0')
- FatalError(SC_ERR_INVALID_VALUE, "Interface name in DPDK config is NULL or empty");
+ FatalError(SC_EINVAL, "Interface name in DPDK config is NULL or empty");
retval = rte_eth_dev_get_port_by_name(entry_str, &iconf->port_id);
if (retval < 0)
}
if (entry_str == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Number of threads for interface \"%s\" not specified",
- iconf->iface);
+ SCLogError(SC_EINVAL, "Number of threads for interface \"%s\" not specified", iconf->iface);
SCReturnInt(-EINVAL);
}
}
if (StringParseInt32(&iconf->threads, 10, 0, entry_str) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
+ SCLogError(SC_EINVAL,
"Threads entry for interface %s contain non-numerical characters - \"%s\"",
iconf->iface, entry_str);
SCReturnInt(-EINVAL);
}
if (iconf->threads < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Interface %s has a negative number of threads",
- iconf->iface);
+ SCLogError(SC_EINVAL, "Interface %s has a negative number of threads", iconf->iface);
SCReturnInt(-ERANGE);
}
SCEnter();
iconf->nb_rx_queues = nb_queues;
if (iconf->nb_rx_queues < 1) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Interface %s requires to have positive number of RX queues", iconf->iface);
+ SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX queues",
+ iconf->iface);
SCReturnInt(-ERANGE);
}
SCEnter();
iconf->nb_tx_queues = nb_queues;
if (iconf->nb_tx_queues < 1) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Interface %s requires to have positive number of TX queues", iconf->iface);
+ SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX queues",
+ iconf->iface);
SCReturnInt(-ERANGE);
}
{
SCEnter();
if (entry_int <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Interface %s requires to have positive memory pool size",
- iconf->iface);
+ SCLogError(
+ SC_EINVAL, "Interface %s requires to have positive memory pool size", iconf->iface);
SCReturnInt(-ERANGE);
}
// RTE_MEMPOOL_CACHE_MAX_SIZE (by default 512) and "mempool-size / 1.5"
// and at the same time "mempool-size modulo cache_size == 0".
if (iconf->mempool_size == 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Cannot calculate mempool cache size of a mempool with size %d",
+ SCLogError(SC_EINVAL, "Cannot calculate mempool cache size of a mempool with size %d",
iconf->mempool_size);
SCReturnInt(-EINVAL);
}
}
if (StringParseUint32(&iconf->mempool_cache_size, 10, 0, entry_str) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
+ SCLogError(SC_EINVAL,
"Mempool cache size entry for interface %s contain non-numerical "
"characters - \"%s\"",
iconf->iface, entry_str);
}
if (iconf->mempool_cache_size <= 0 || iconf->mempool_cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
- SCLogError(SC_ERR_INVALID_VALUE,
+ SCLogError(SC_EINVAL,
"Interface %s requires to have mempool cache size set to a positive number smaller "
"than %" PRIu32,
iconf->iface, RTE_MEMPOOL_CACHE_MAX_SIZE);
{
SCEnter();
if (entry_int <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Interface %s requires to have positive number of RX descriptors", iconf->iface);
+ SCLogError(SC_EINVAL, "Interface %s requires to have positive number of RX descriptors",
+ iconf->iface);
SCReturnInt(-ERANGE);
}
{
SCEnter();
if (entry_int <= 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Interface %s requires to have positive number of TX descriptors", iconf->iface);
+ SCLogError(SC_EINVAL, "Interface %s requires to have positive number of TX descriptors",
+ iconf->iface);
SCReturnInt(-ERANGE);
}
}
if (StringParseUint64(&iconf->rss_hf, 0, 0, entry_str) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
+ SCLogError(SC_EINVAL,
"RSS hash functions entry for interface %s contain non-numerical "
"characters - \"%s\"",
iconf->iface, entry_str);
{
SCEnter();
if (entry_int < RTE_ETHER_MIN_MTU || entry_int > RTE_ETHER_MAX_JUMBO_FRAME_LEN) {
- SCLogError(SC_ERR_INVALID_VALUE,
+ SCLogError(SC_EINVAL,
"Interface %s requires to have size of MTU between %" PRIu32 " and %" PRIu32,
iconf->iface, RTE_ETHER_MIN_MTU, RTE_ETHER_MAX_JUMBO_FRAME_LEN);
SCReturnInt(-ERANGE);
{
SCEnter();
if (entry_str == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Interface %s has no copy mode specified, changing to %s ", iconf->iface,
- DPDK_CONFIG_DEFAULT_COPY_MODE);
+ SCLogWarning(SC_EINVAL, "Interface %s has no copy mode specified, changing to %s ",
+ iconf->iface, DPDK_CONFIG_DEFAULT_COPY_MODE);
entry_str = DPDK_CONFIG_DEFAULT_COPY_MODE;
}
if (strcmp(entry_str, "none") != 0 && strcmp(entry_str, "tap") != 0 &&
strcmp(entry_str, "ips") != 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
+ SCLogWarning(SC_EINVAL,
"Copy mode \"%s\" is not one of the possible values (none|tap|ips) for interface "
"%s. Changing to %s",
entry_str, iconf->iface, DPDK_CONFIG_DEFAULT_COPY_MODE);
/* device+2 is a pointer to the beginning of the stream id after the constant nt portion */
if (StringParseUint16(&conf->stream_id, 10, 0, device + 2) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for stream_id: %s", device + 2);
+ SCLogError(SC_EINVAL, "Invalid value for stream_id: %s", device + 2);
SCFree(conf);
return NULL;
}
ns->threads_auto = true;
} else {
if (StringParseUint16(&ns->threads, 10, 0, threadsstr) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid config value for "
- "threads: %s, resetting to 0", threadsstr);
+ SCLogWarning(SC_EINVAL,
+ "Invalid config value for "
+ "threads: %s, resetting to 0",
+ threadsstr);
ns->threads = 0;
}
}
for (ldev = 0; ldev < nlive; ldev++) {
const char *live_dev = LiveGetDeviceName(ldev);
if (live_dev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
const char *copymodestr = NULL;
if (if_root == NULL) {
if (if_default == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = if_default;
for (ldev = 0; ldev < nlive; ldev++) {
const char *live_dev = LiveGetDeviceName(ldev);
if (live_dev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
if (if_root == NULL) {
if (if_default == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
+ SCLogError(SC_EINVAL, "Problem with config file");
return 0;
}
if_root = if_default;
} else {
if (threadsstr != NULL) {
if (StringParseInt32(&aconf->threads, 10, 0, (const char *)threadsstr) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pcap.threads: %s, resetting to 1", threadsstr);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pcap.threads: %s, resetting to 1",
+ threadsstr);
aconf->threads = 1;
}
}
} else {
if (threadsstr != NULL) {
if (StringParseInt32(&pfconf->threads, 10, 0, threadsstr) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pfring.threads: '%s'. Resetting to 1.", threadsstr);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pfring.threads: '%s'. Resetting to 1.",
+ threadsstr);
pfconf->threads = 1;
}
}
SCLogError(SC_ERR_INVALID_ARGUMENT,"Could not get cluster-id from config");
} else {
if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pfring.cluster_id: '%s'. Resetting to 1.", tmpclusterid);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pfring.cluster_id: '%s'. Resetting to 1.",
+ tmpclusterid);
pfconf->cluster_id = 1;
}
pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
} else {
uint16_t threads = 0;
if (StringParseUint16(&threads, 10, 0, (const char *)threadsstr) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pfring.threads: '%s'. Resetting to 1.", threadsstr);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pfring.threads: '%s'. Resetting to 1.",
+ threadsstr);
pfconf->threads = 1;
} else {
pfconf->threads = threads;
/* command line value has precedence */
if (ConfGet("pfring.cluster-id", &tmpclusterid) == 1) {
if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pfring.cluster-id: '%s'. Resetting to 1.", tmpclusterid);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pfring.cluster-id: '%s'. Resetting to 1.",
+ tmpclusterid);
pfconf->cluster_id = 1;
}
pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
"Could not get cluster-id from config");
} else {
if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for "
- "pfring.cluster-id: '%s'. Resetting to 1.", tmpclusterid);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for "
+ "pfring.cluster-id: '%s'. Resetting to 1.",
+ tmpclusterid);
pfconf->cluster_id = 1;
}
pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
}
if (p->ethh == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Should have an Ethernet header");
+ SCLogWarning(SC_EINVAL, "Should have an Ethernet header");
return;
}
if (snaplen == 0) {
snaplen = GetIfaceMaxPacketSize(ptv->iface);
if (snaplen <= 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Unable to get MTU, setting snaplen to sane default of 1514");
+ SCLogWarning(SC_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
snaplen = 1514;
}
}
ptv->req.v2.tp_block_size = getpagesize() << order;
int frames_per_block = ptv->req.v2.tp_block_size / ptv->req.v2.tp_frame_size;
if (frames_per_block == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Frame size bigger than block size");
+ SCLogError(SC_EINVAL, "Frame size bigger than block size");
return -1;
}
ptv->req.v2.tp_frame_nr = ptv->ring_size;
if (snaplen == 0) {
snaplen = GetIfaceMaxPacketSize(ptv->iface);
if (snaplen <= 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Unable to get MTU, setting snaplen to sane default of 1514");
+ SCLogWarning(SC_EINVAL, "Unable to get MTU, setting snaplen to sane default of 1514");
snaplen = 1514;
}
}
frames_per_block = ptv->req.v3.tp_block_size / ptv->req.v3.tp_frame_size;
if (frames_per_block == 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Block size is too small, it should be at least %d",
- ptv->req.v3.tp_frame_size);
+ SCLogError(SC_EINVAL, "Block size is too small, it should be at least %d",
+ ptv->req.v3.tp_frame_size);
return -1;
}
ptv->req.v3.tp_block_nr = ptv->ring_size / frames_per_block + 1;
close(fd);
if (r < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "fanout not supported by kernel: "
- "Kernel too old or cluster-id %d already in use.", cluster_id);
+ SCLogError(SC_EINVAL,
+ "fanout not supported by kernel: "
+ "Kernel too old or cluster-id %d already in use.",
+ cluster_id);
return 0;
}
return 1;
{
int pfd = ptv->ebpf_lb_fd;
if (pfd == -1) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Fanout file descriptor is invalid");
+ SCLogError(SC_EINVAL, "Fanout file descriptor is invalid");
return -1;
}
if (setsockopt(ptv->socket, SOL_PACKET, PACKET_FANOUT_DATA, &pfd, sizeof(pfd))) {
- SCLogError(SC_ERR_INVALID_VALUE, "Error setting ebpf");
+ SCLogError(SC_EINVAL, "Error setting ebpf");
return -1;
}
SCLogInfo("Activated eBPF on socket");
{
int pfd = ptv->ebpf_filter_fd;
if (pfd == -1) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Filter file descriptor is invalid");
+ SCLogError(SC_EINVAL, "Filter file descriptor is invalid");
return -1;
}
if (setsockopt(ptv->socket, SOL_SOCKET, SO_ATTACH_BPF, &pfd, sizeof(pfd))) {
- SCLogError(SC_ERR_INVALID_VALUE, "Error setting ebpf: %s", strerror(errno));
+ SCLogError(SC_EINVAL, "Error setting ebpf: %s", strerror(errno));
return -1;
}
SCLogInfo("Activated eBPF filter on socket");
ptv->livedev = LiveGetDevice(ptv->iface);
if (ptv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+ SCLogError(SC_EINVAL, "Unable to find Live device");
SCFree(ptv);
SCReturnInt(TM_ECODE_FAILED);
}
ptv->v4_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v4");
if (ptv->v4_map_fd == -1) {
if (g_flowv4_ok == false) {
- SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'",
- "flow_table_v4");
+ SCLogError(SC_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v4");
g_flowv4_ok = true;
}
}
ptv->v6_map_fd = EBPFGetMapFDByName(ptv->iface, "flow_table_v6");
if (ptv->v6_map_fd == -1) {
if (g_flowv6_ok) {
- SCLogError(SC_ERR_INVALID_VALUE, "Can't find eBPF map fd for '%s'",
- "flow_table_v6");
+ SCLogError(SC_EINVAL, "Can't find eBPF map fd for '%s'", "flow_table_v6");
g_flowv6_ok = false;
}
}
ewtn->livedev = LiveGetDevice(initdata);
if (ewtn->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to get %s live device",
- (char *)initdata);
+ SCLogError(SC_EINVAL, "Unable to get %s live device", (char *)initdata);
SCFree(ewtn);
SCReturnInt(TM_ECODE_FAILED);
}
ntv->livedev = LiveGetDevice(aconf->iface_name);
if (ntv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+ SCLogError(SC_EINVAL, "Unable to find Live device");
goto error_ntv;
}
ntv->livedev = LiveGetDevice(nflconfig->numgroup);
if (ntv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
- SCFree(ntv);
- SCReturnInt(TM_ECODE_FAILED);
+ SCLogError(SC_EINVAL, "Unable to find Live device");
+ SCFree(ntv);
+ SCReturnInt(TM_ECODE_FAILED);
}
/* set a timeout to the socket so we can check for a signal
ntv->livedev = LiveGetDevice(queue);
if (ntv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+ SCLogError(SC_EINVAL, "Unable to find Live device");
return -1;
}
ptv->livedev = LiveGetDevice(pcapconfig->iface);
if (ptv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "unable to find Live device");
+ SCLogError(SC_EINVAL, "unable to find Live device");
SCFree(ptv);
SCReturnInt(TM_ECODE_FAILED);
}
ptv->livedev = LiveGetDevice(pfconf->iface);
if (ptv->livedev == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to find Live device");
+ SCLogError(SC_EINVAL, "Unable to find Live device");
SCFree(ptv);
SCReturnInt(TM_ECODE_FAILED);
}
if (ptv->checksum_mode == CHECKSUM_VALIDATION_RXONLY) {
if (strncmp(ptv->interface, "dna", 3) == 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Can't use rxonly checksum-checks on DNA interface,"
- " resetting to auto");
+ SCLogWarning(SC_EINVAL, "Can't use rxonly checksum-checks on DNA interface,"
+ " resetting to auto");
ptv->checksum_mode = CHECKSUM_VALIDATION_AUTO;
} else {
opflag |= PF_RING_LONG_HEADER;
SCMutexUnlock(&pfring_bpf_set_filter_lock);
if (rc < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Failed to compile BPF \"%s\"",
- ptv->bpf_filter);
+ SCLogError(SC_EINVAL, "Failed to compile BPF \"%s\"", ptv->bpf_filter);
return TM_ECODE_FAILED;
}
}
if (snprintf(conf_var_full_name, strlen(conf_var_type_name) + strlen(conf_var_name) + 2,
"%s.%s", conf_var_type_name, conf_var_name) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Error in making the conf full name");
+ SCLogError(SC_EINVAL, "Error in making the conf full name");
goto end;
}
}
if (found == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "No fd found in client list");
+ SCLogError(SC_EINVAL, "No fd found in client list");
return;
}
const char* envvar = getenv("NUMBER_OF_PROCESSORS");
if (envvar != NULL) {
if (StringParseInt64(&nprocs, 10, 0, envvar) < 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for number of "
- "processors: %s", envvar);
+ SCLogWarning(SC_EINVAL,
+ "Invalid value for number of "
+ "processors: %s",
+ envvar);
return 0;
}
}
LiveDevice *pd;
if (name == NULL) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "Name of device should not be null");
+ SCLogWarning(SC_EINVAL, "Name of device should not be null");
return NULL;
}
}
if (! path) {
- SCLogError(SC_ERR_INVALID_VALUE, "No file defined to load eBPF from");
+ SCLogError(SC_EINVAL, "No file defined to load eBPF from");
return -1;
}
char err_buf[128];
libbpf_strerror(error, err_buf,
sizeof(err_buf));
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to load eBPF objects in '%s': %s",
- path, err_buf);
+ SCLogError(SC_EINVAL, "Unable to load eBPF objects in '%s': %s", path, err_buf);
return -1;
}
}
if (found == false) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "No section '%s' in '%s' file. Will not be able to use the file",
- section,
- path);
+ SCLogError(SC_EINVAL, "No section '%s' in '%s' file. Will not be able to use the file",
+ section, path);
return -1;
}
} else {
char buf[129];
libbpf_strerror(err, buf, sizeof(buf));
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to load eBPF object: %s (%d)",
- buf,
- err);
+ SCLogError(SC_EINVAL, "Unable to load eBPF object: %s (%d)", buf, err);
}
return -1;
}
* (XDP case). */
pfd = bpf_program__fd(bpfprog);
if (pfd == -1) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to find %s section", section);
+ SCLogError(SC_EINVAL, "Unable to find %s section", section);
return -1;
}
#ifdef HAVE_PACKET_XDP
unsigned int ifindex = if_nametoindex(iface);
if (ifindex == 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unknown interface '%s'", iface);
+ SCLogError(SC_EINVAL, "Unknown interface '%s'", iface);
return -1;
}
#ifdef HAVE_BPF_XDP_ATTACH
if (err != 0) {
char buf[129];
libbpf_strerror(err, buf, sizeof(buf));
- SCLogError(SC_ERR_INVALID_VALUE, "Unable to set XDP on '%s': %s (%d)",
- iface, buf, err);
+ SCLogError(SC_EINVAL, "Unable to set XDP on '%s': %s (%d)", iface, buf, err);
return -1;
}
#endif
uint64_t hash_cnt = 0;
if (tcfg->cpus_count == 0) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "CPU count should not be 0");
+ SCLogWarning(SC_EINVAL, "CPU count should not be 0");
return 0;
}
static void EBPFRedirectMapAddCPU(int i, void *data)
{
if (EBPFAddCPUToMap(data, i) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to add CPU %d to set", i);
+ SCLogError(SC_EINVAL, "Unable to add CPU %d to set", i);
} else {
g_redirect_iface_cpu_counter++;
}
uint32_t key0 = 0;
int mapfd = EBPFGetMapFDByName(iface, "cpus_count");
if (mapfd < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to find 'cpus_count' map");
+ SCLogError(SC_EINVAL, "Unable to find 'cpus_count' map");
return;
}
g_redirect_iface_cpu_counter = 0;
{
int mapfd = EBPFGetMapFDByName(iface, "tx_peer");
if (mapfd < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to find 'tx_peer' map");
+ SCLogError(SC_EINVAL, "Unable to find 'tx_peer' map");
return -1;
}
int intmapfd = EBPFGetMapFDByName(iface, "tx_peer_int");
if (intmapfd < 0) {
- SCLogError(SC_ERR_INVALID_VALUE,
- "Unable to find 'tx_peer_int' map");
+ SCLogError(SC_EINVAL, "Unable to find 'tx_peer_int' map");
return -1;
}
int key0 = 0;
unsigned int peer_index = if_nametoindex(out_iface);
if (peer_index == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "No iface '%s'", out_iface);
+ SCLogError(SC_EINVAL, "No iface '%s'", out_iface);
return -1;
}
int ret = bpf_map_update_elem(mapfd, &key0, &peer_index, BPF_ANY);
CASE_CODE (SC_ERR_MULTIPLE_RUN_MODE);
CASE_CODE (SC_ERR_BPF);
CASE_CODE (SC_ERR_MISSING_CONFIG_PARAM);
- CASE_CODE (SC_ERR_UNKNOWN_VALUE);
- CASE_CODE (SC_ERR_INVALID_VALUE);
+ CASE_CODE(SC_ERR_UNKNOWN_VALUE);
CASE_CODE (SC_ERR_UNKNOWN_REGEX_MOD);
CASE_CODE (SC_ERR_INVALID_OPERATOR);
CASE_CODE (SC_ERR_PCAP_RECV_INIT);
SC_ERR_BPF,
SC_ERR_BYTE_EXTRACT_FAILED,
SC_ERR_UNKNOWN_VALUE,
- SC_ERR_INVALID_VALUE,
SC_ERR_UNKNOWN_REGEX_MOD,
SC_ERR_INVALID_OPERATOR,
SC_ERR_PCAP_RECV_INIT,
hb->next = NULL;
if (hash >= ht->array_size) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "attempt to insert element out of hash array\n");
+ SCLogWarning(SC_EINVAL, "attempt to insert element out of hash array\n");
goto error;
}
hash = ht->Hash(ht, data, datalen);
if (hash >= ht->array_size) {
- SCLogWarning(SC_ERR_INVALID_VALUE, "attempt to access element out of hash array\n");
+ SCLogWarning(SC_EINVAL, "attempt to access element out of hash array\n");
return NULL;
}
/* get local version */
if (uname(&kuname) != 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid uname return: %s",
- strerror(errno));
+ SCLogError(SC_EINVAL, "Invalid uname return: %s", strerror(errno));
return 0;
}
bool err = false;
if (StringParseInt32(&kmajor, 10, 0, (const char *)list[1]) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for kmajor: '%s'", list[1]);
+ SCLogError(SC_EINVAL, "Invalid value for kmajor: '%s'", list[1]);
err = true;
}
if (StringParseInt32(&kminor, 10, 0, (const char *)list[2]) < 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid value for kminor: '%s'", list[2]);
+ SCLogError(SC_EINVAL, "Invalid value for kminor: '%s'", list[2]);
err = true;
}
}
if (buffer->data == NULL) {
- SCLogError(SC_ERR_INVALID_VALUE, "Buffer data should not be NULL");
+ SCLogError(SC_EINVAL, "Buffer data should not be NULL");
return NULL;
}
}
break;
default:
- SCLogWarning(SC_ERR_INVALID_VALUE,
- "Unsupported error code %d",
- redis->err);
+ SCLogWarning(SC_EINVAL, "Unsupported error code %d", redis->err);
return -1;
}
}
ret = 0;
break;
default:
- SCLogError(SC_ERR_INVALID_VALUE,
- "Redis default triggered with %d", reply->type);
+ SCLogError(SC_EINVAL, "Redis default triggered with %d", reply->type);
SCConfLogReopenSyncRedis(file_ctx);
break;
}
FatalError(SC_ERR_FATAL, "Error allocating redis server string");
}
if (StringParseUint16(&log_ctx->redis_setup.port, 10, 0, (const char *)redis_port) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Invalid value for redis port: %s", redis_port);
+ FatalError(SC_EINVAL, "Invalid value for redis port: %s", redis_port);
}
log_ctx->Close = SCLogFileCloseRedis;
if (StringParseUint8(&start, 10, end_str - lnode->val, (const char *)lnode->val) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
- " worker range start: '%s'", lnode->val);
+ FatalError(SC_EINVAL,
+ "Napatech invalid"
+ " worker range start: '%s'",
+ lnode->val);
}
if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
- " worker range end: '%s'", (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
+ FatalError(SC_EINVAL,
+ "Napatech invalid"
+ " worker range end: '%s'",
+ (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
}
if (end < start) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid"
- " worker range start: '%d' is greater than end: '%d'", start, end);
+ FatalError(SC_EINVAL,
+ "Napatech invalid"
+ " worker range start: '%d' is greater than end: '%d'",
+ start, end);
}
worker_count = end - start + 1;
if (StringParseUint8(&start, 10, end_str - stream->val,
(const char *)stream->val) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
- "stream id start: '%s'", stream->val);
+ FatalError(SC_EINVAL,
+ "Napatech invalid "
+ "stream id start: '%s'",
+ stream->val);
}
if (StringParseUint8(&end, 10, 0, (const char *) (end_str + 1)) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
- "stream id end: '%s'", (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
+ FatalError(SC_EINVAL,
+ "Napatech invalid "
+ "stream id end: '%s'",
+ (end_str != NULL) ? (const char *)(end_str + 1) : "Null");
}
} else {
if (stream_spec == CONFIG_SPECIFIER_RANGE) {
stream_spec = CONFIG_SPECIFIER_INDIVIDUAL;
if (StringParseUint8(&stream_config[instance_cnt].stream_id,
10, 0, (const char *)stream->val) < 0) {
- FatalError(SC_ERR_INVALID_VALUE, "Napatech invalid "
- "stream id: '%s'", stream->val);
+ FatalError(SC_EINVAL,
+ "Napatech invalid "
+ "stream id: '%s'",
+ stream->val);
}
start = stream_config[instance_cnt].stream_id;
end = stream_config[instance_cnt].stream_id;
/* Format IPv6 without deleting zeroes */
return PrintInetIPv6(src, dst, size);
default:
- SCLogError(SC_ERR_INVALID_VALUE, "Unsupported protocol: %d", af);
+ SCLogError(SC_EINVAL, "Unsupported protocol: %d", af);
}
return NULL;
}
tm_module = TmModuleGetByName(recv_mod_name);
if (tm_module == NULL) {
- FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName failed for %s", recv_mod_name);
+ FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
}
TmSlotSetFuncAppend(tv, tm_module, aconf);
tm_module = TmModuleGetByName(decode_mod_name);
if (tm_module == NULL) {
- FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName %s failed", decode_mod_name);
+ FatalError(SC_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
}
TmSlotSetFuncAppend(tv, tm_module, NULL);
tm_module = TmModuleGetByName(recv_mod_name);
if (tm_module == NULL) {
- FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName failed for %s", recv_mod_name);
+ FatalError(SC_EINVAL, "TmModuleGetByName failed for %s", recv_mod_name);
}
TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
tm_module = TmModuleGetByName(decode_mod_name);
if (tm_module == NULL) {
- FatalError(SC_ERR_INVALID_VALUE, "TmModuleGetByName %s failed", decode_mod_name);
+ FatalError(SC_EINVAL, "TmModuleGetByName %s failed", decode_mod_name);
}
TmSlotSetFuncAppend(tv, tm_module, NULL);
#ifndef BUILD_HYPERSCAN
if ((spm_algo != NULL) && (strcmp(spm_algo, "hs") == 0)) {
- FatalError(SC_ERR_INVALID_VALUE, "Hyperscan (hs) support for spm-algo is "
- "not compiled into Suricata.");
+ FatalError(SC_EINVAL, "Hyperscan (hs) support for spm-algo is "
+ "not compiled into Suricata.");
}
#endif
SCLogError(SC_ERR_INVALID_YAML_CONF_ENTRY,
StorageList *list = storage_list;
while (list) {
if (strcmp(name, list->map.name) == 0 && type == list->map.type) {
- SCLogError(SC_ERR_INVALID_VALUE, "storage for type \"%s\" with "
- "name \"%s\" already registered", StoragePrintType(type),
- name);
+ SCLogError(SC_EINVAL,
+ "storage for type \"%s\" with "
+ "name \"%s\" already registered",
+ StoragePrintType(type), name);
return -1;
}
SigMatchAppendSMToList(s, sm, DETECT_SM_LIST_SUPPRESS);
}
} else if (id > 0 && gid == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Can't use a event config that has "
- "sid > 0 and gid == 0. Please fix this "
- "in your threshold.config file");
+ SCLogError(SC_EINVAL, "Can't use a event config that has "
+ "sid > 0 and gid == 0. Please fix this "
+ "in your threshold.config file");
goto error;
} else {
s = SigFindSignatureBySidGid(de_ctx, id, gid);
}
}
} else if (id > 0 && gid == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "Can't use a event config that has "
- "sid > 0 and gid == 0. Please fix this "
- "in your threshold.conf file");
+ SCLogError(SC_EINVAL, "Can't use a event config that has "
+ "sid > 0 and gid == 0. Please fix this "
+ "in your threshold.conf file");
} else {
s = SigFindSignatureBySidGid(de_ctx, id, gid);
if (s == NULL) {
} else if (strcasecmp(th_rule_type,"suppress") == 0) {
rule_type = THRESHOLD_TYPE_SUPPRESS;
} else {
- SCLogError(SC_ERR_INVALID_VALUE, "rule type %s is unknown", th_rule_type);
+ SCLogError(SC_EINVAL, "rule type %s is unknown", th_rule_type);
goto error;
}
else if (strcasecmp(th_track,"by_rule") == 0)
parsed_track = TRACK_RULE;
else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid track parameter %s in %s", th_track, rawstr);
+ SCLogError(SC_EINVAL, "Invalid track parameter %s in %s", th_track, rawstr);
goto error;
}
goto error;
}
if (parsed_count == 0) {
- SCLogError(SC_ERR_INVALID_VALUE, "rate filter count should be > 0");
+ SCLogError(SC_EINVAL, "rate filter count should be > 0");
goto error;
}
parsed_track = TRACK_EITHER;
}
else {
- SCLogError(SC_ERR_INVALID_VALUE, "Invalid track parameter %s in %s", th_track, rule_extend);
+ SCLogError(
+ SC_EINVAL, "Invalid track parameter %s in %s", th_track, rule_extend);
goto error;
}
}