Skip to content

Commit 9cdf4e3

Browse files
committed
networkd: replace geneve/vxlan port parsing with generic config_parse_ip_port
1 parent 177d0b2 commit 9cdf4e3

File tree

5 files changed

+2
-84
lines changed

5 files changed

+2
-84
lines changed

src/network/netdev/geneve.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -238,36 +238,6 @@ int config_parse_geneve_address(const char *unit,
238238
return 0;
239239
}
240240

241-
int config_parse_geneve_destination_port(const char *unit,
242-
const char *filename,
243-
unsigned line,
244-
const char *section,
245-
unsigned section_line,
246-
const char *lvalue,
247-
int ltype,
248-
const char *rvalue,
249-
void *data,
250-
void *userdata) {
251-
Geneve *v = userdata;
252-
uint16_t port;
253-
int r;
254-
255-
assert(filename);
256-
assert(lvalue);
257-
assert(rvalue);
258-
assert(data);
259-
260-
r = parse_ip_port(rvalue, &port);
261-
if (r < 0) {
262-
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Geneve destination port '%s'.", rvalue);
263-
return 0;
264-
}
265-
266-
v->dest_port = port;
267-
268-
return 0;
269-
}
270-
271241
int config_parse_geneve_flow_label(const char *unit,
272242
const char *filename,
273243
unsigned line,

src/network/netdev/geneve.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,6 @@ int config_parse_geneve_address(const char *unit,
7373
void *data,
7474
void *userdata);
7575

76-
int config_parse_geneve_destination_port(const char *unit,
77-
const char *filename,
78-
unsigned line,
79-
const char *section,
80-
unsigned section_line,
81-
const char *lvalue,
82-
int ltype,
83-
const char *rvalue,
84-
void *data,
85-
void *userdata);
86-
8776
int config_parse_geneve_flow_label(const char *unit,
8877
const char *filename,
8978
unsigned line,

src/network/netdev/netdev-gperf.gperf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ VXLAN.FDBAgeingSec, config_parse_sec, 0,
7979
VXLAN.GroupPolicyExtension, config_parse_bool, 0, offsetof(VxLan, group_policy)
8080
VXLAN.MaximumFDBEntries, config_parse_unsigned, 0, offsetof(VxLan, max_fdb)
8181
VXLAN.PortRange, config_parse_port_range, 0, 0
82-
VXLAN.DestinationPort, config_parse_destination_port, 0, offsetof(VxLan, dest_port)
82+
VXLAN.DestinationPort, config_parse_ip_port, 0, offsetof(VxLan, dest_port)
8383
VXLAN.FlowLabel, config_parse_flow_label, 0, 0
8484
GENEVE.Id, config_parse_geneve_vni, 0, offsetof(Geneve, id)
8585
GENEVE.Remote, config_parse_geneve_address, 0, offsetof(Geneve, remote)
@@ -88,7 +88,7 @@ GENEVE.TTL, config_parse_uint8, 0,
8888
GENEVE.UDPChecksum, config_parse_bool, 0, offsetof(Geneve, udpcsum)
8989
GENEVE.UDP6ZeroCheckSumRx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumrx)
9090
GENEVE.UDP6ZeroCheckSumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
91-
GENEVE.DestinationPort, config_parse_geneve_destination_port, 0, offsetof(Geneve, dest_port)
91+
GENEVE.DestinationPort, config_parse_ip_port, 0, offsetof(Geneve, dest_port)
9292
GENEVE.FlowLabel, config_parse_geneve_flow_label, 0, 0
9393
Tun.OneQueue, config_parse_bool, 0, offsetof(TunTap, one_queue)
9494
Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue)

src/network/netdev/vxlan.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -271,36 +271,6 @@ int config_parse_port_range(const char *unit,
271271
return 0;
272272
}
273273

274-
int config_parse_destination_port(const char *unit,
275-
const char *filename,
276-
unsigned line,
277-
const char *section,
278-
unsigned section_line,
279-
const char *lvalue,
280-
int ltype,
281-
const char *rvalue,
282-
void *data,
283-
void *userdata) {
284-
VxLan *v = userdata;
285-
uint16_t port;
286-
int r;
287-
288-
assert(filename);
289-
assert(lvalue);
290-
assert(rvalue);
291-
assert(data);
292-
293-
r = parse_ip_port(rvalue, &port);
294-
if (r < 0) {
295-
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse VXLAN destination port '%s'.", rvalue);
296-
return 0;
297-
}
298-
299-
v->dest_port = port;
300-
301-
return 0;
302-
}
303-
304274
int config_parse_flow_label(const char *unit,
305275
const char *filename,
306276
unsigned line,

src/network/netdev/vxlan.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,6 @@ int config_parse_port_range(const char *unit,
8686
void *data,
8787
void *userdata);
8888

89-
int config_parse_destination_port(const char *unit,
90-
const char *filename,
91-
unsigned line,
92-
const char *section,
93-
unsigned section_line,
94-
const char *lvalue,
95-
int ltype,
96-
const char *rvalue,
97-
void *data,
98-
void *userdata);
99-
10089
int config_parse_flow_label(const char *unit,
10190
const char *filename,
10291
unsigned line,

0 commit comments

Comments
 (0)