summaryrefslogtreecommitdiff
path: root/src/network/networkd-lldp-tx.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-09 15:01:00 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-09 15:13:12 +0200
commit89fa9a6b7b2505aa2ce18febf1e28e79510dfec2 (patch)
treec4652a7b876333a5c1af89ef7d63aa4067e3ceae /src/network/networkd-lldp-tx.c
parentbc1f27ff5515d8e35b881281d6f2f1a7ff1fed27 (diff)
downloadsystemd-89fa9a6b7b2505aa2ce18febf1e28e79510dfec2.tar.gz
networkd: add shared parser for mud urls
The same buggy code was triplicated…
Diffstat (limited to 'src/network/networkd-lldp-tx.c')
-rw-r--r--src/network/networkd-lldp-tx.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c
index c2d269156e..e6e0b5ee54 100644
--- a/src/network/networkd-lldp-tx.c
+++ b/src/network/networkd-lldp-tx.c
@@ -7,7 +7,6 @@
#include "alloc-util.h"
#include "env-file.h"
-#include "escape.h"
#include "fd-util.h"
#include "hostname-util.h"
#include "missing_network.h"
@@ -21,7 +20,6 @@
#include "string-util.h"
#include "strv.h"
#include "unaligned.h"
-#include "web-util.h"
/* The LLDP spec calls this "txFastInit", see 9.2.5.19 */
#define LLDP_TX_FAST_INIT 4U
@@ -428,29 +426,12 @@ int config_parse_lldp_mud(
void *data,
void *userdata) {
- _cleanup_free_ char *unescaped = NULL;
- Network *n = data;
- ssize_t l;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
-
- l = cunescape(rvalue, 0, &unescaped);
- if (l < 0) {
- log_syntax(unit, LOG_WARNING, filename, line, l,
- "Failed to Failed to unescape LLDP MUD URL, ignoring: %s", rvalue);
- return 0;
- }
-
- if (!http_url_is_valid(unescaped) || strlen(unescaped) > 255) {
- log_syntax(unit, LOG_WARNING, filename, line, 0,
- "Failed to parse LLDP MUD URL '%s', ignoring: %m", rvalue);
+ Network *network = data;
- return 0;
- }
+ assert(network);
- return free_and_replace(n->lldp_mud, unescaped);
+ return config_parse_mud_url(unit, filename, line, section, section_line, lvalue, ltype, rvalue,
+ &network->lldp_mud);
}
static const char * const lldp_emit_table[_LLDP_EMIT_MAX] = {