diff --git a/conf_schema.c b/conf_schema.c index 4abf8b35..ad22e9c7 100644 --- a/conf_schema.c +++ b/conf_schema.c @@ -989,6 +989,20 @@ int vld_network_interface(const struct cf_om_node *parent, struct config_network cf_warn_missing_node(parent, "file"); return result | CFSUB(CFINCOMPATIBLE); } + if (nifp->socket_type != SOCK_FILE){ + int nodei_drop=-1; + if (nifp->drop_packets) + nodei_drop=cf_om_get_child(parent, "drop_packets", NULL); + if (nifp->drop_broadcasts) + nodei_drop=cf_om_get_child(parent, "drop_broadcasts", NULL); + if (nifp->drop_unicasts) + nodei_drop=cf_om_get_child(parent, "drop_unicasts", NULL); + if (nodei_drop!=-1){ + int nodei_socket_type=cf_om_get_child(parent, "socket_type", NULL); + cf_warn_incompatible(parent->nodv[nodei_socket_type], parent->nodv[nodei_drop]); + return result | CFSUB(CFINCOMPATIBLE); + } + } } return result; } diff --git a/tests/config b/tests/config index 1873743b..09045fc9 100755 --- a/tests/config +++ b/tests/config @@ -254,10 +254,6 @@ doc_InterfacesModernDummy="Modern 'interfaces.N.file' config option" test_InterfacesModernDummy() { executeOk_servald config set interfaces.0.file dummyname } -teardown_InterfacesModernDummy() { - tfw_cat $SERVALINSTANCE_PATH/serval.conf - teardown -} doc_InterfacesModernIncompatible="Config options 'interfaces.match' and 'interfaces.file' are incompatible" test_InterfacesModernIncompatible() { @@ -270,4 +266,17 @@ test_InterfacesModernIncompatible() { --error-pattern='config file.*loaded despite defects.*incompatible' } +doc_InterfaceDropDgramIncompatible="Config options 'interfaces.drop_packets' and 'interfaces.socket_type=DGRAM' are incompatible" +test_InterfaceDropDgramIncompatible() { + executeOk_servald config \ + set interfaces.0.match eth \ + set interfaces.0.socket_type dgram + execute --stderr --core-backtrace --executable=$servald \ + config set interfaces.0.drop_packets 10 + assertExitStatus '==' 2 + assert_stderr_log \ + --warn-pattern='"interfaces\.0\..*incompatible' \ + --error-pattern='config file.*loaded despite defects.*incompatible' +} + runTests "$@"