mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-27 10:25:06 +03:00
Merge pull request #5808 from ssahani/util
conf parser: add config_parse_ip_port
This commit is contained in:
commit
2766d951c9
@ -600,8 +600,8 @@
|
||||
<listitem>
|
||||
<para>Configures the default destination UDP port on a per-device basis.
|
||||
If destination port is not specified then Linux kernel default will be used.
|
||||
Set destination port 4789 to get the IANA assigned value,
|
||||
and destination port 0 to get default values.</para>
|
||||
Set destination port 4789 to get the IANA assigned value. If not set or if the
|
||||
destination port is assigned the empty string the default port of 4789 is used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -646,13 +646,13 @@
|
||||
<varlistentry>
|
||||
<term><varname>TOS=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the TOS value to use in outgoing packets. Ranges [1-255]. </para>
|
||||
<para>Specifies the TOS value to use in outgoing packets. Ranges [1-255].</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>TTL=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies the TTL value to use in outgoing packets. Ranges [1-255]. </para>
|
||||
<para>Specifies the TTL value to use in outgoing packets. Ranges [1-255].</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -676,7 +676,8 @@
|
||||
<varlistentry>
|
||||
<term><varname>DestinationPort=</varname></term>
|
||||
<listitem>
|
||||
<para>Specifies destination port. Defaults to 6081.</para>
|
||||
<para>Specifies destination port. Defaults to 6081. If not set or assigned the empty string, the default
|
||||
port of 6081 is used.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -238,36 +238,6 @@ int config_parse_geneve_address(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_geneve_destination_port(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
Geneve *v = userdata;
|
||||
uint16_t port;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = parse_ip_port(rvalue, &port);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Geneve destination port '%s'.", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
v->dest_port = port;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_geneve_flow_label(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
|
@ -73,17 +73,6 @@ int config_parse_geneve_address(const char *unit,
|
||||
void *data,
|
||||
void *userdata);
|
||||
|
||||
int config_parse_geneve_destination_port(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata);
|
||||
|
||||
int config_parse_geneve_flow_label(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
|
@ -79,7 +79,7 @@ VXLAN.FDBAgeingSec, config_parse_sec, 0,
|
||||
VXLAN.GroupPolicyExtension, config_parse_bool, 0, offsetof(VxLan, group_policy)
|
||||
VXLAN.MaximumFDBEntries, config_parse_unsigned, 0, offsetof(VxLan, max_fdb)
|
||||
VXLAN.PortRange, config_parse_port_range, 0, 0
|
||||
VXLAN.DestinationPort, config_parse_destination_port, 0, offsetof(VxLan, dest_port)
|
||||
VXLAN.DestinationPort, config_parse_ip_port, 0, offsetof(VxLan, dest_port)
|
||||
VXLAN.FlowLabel, config_parse_flow_label, 0, 0
|
||||
GENEVE.Id, config_parse_geneve_vni, 0, offsetof(Geneve, id)
|
||||
GENEVE.Remote, config_parse_geneve_address, 0, offsetof(Geneve, remote)
|
||||
@ -88,7 +88,7 @@ GENEVE.TTL, config_parse_uint8, 0,
|
||||
GENEVE.UDPChecksum, config_parse_bool, 0, offsetof(Geneve, udpcsum)
|
||||
GENEVE.UDP6ZeroCheckSumRx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumrx)
|
||||
GENEVE.UDP6ZeroCheckSumTx, config_parse_bool, 0, offsetof(Geneve, udp6zerocsumtx)
|
||||
GENEVE.DestinationPort, config_parse_geneve_destination_port, 0, offsetof(Geneve, dest_port)
|
||||
GENEVE.DestinationPort, config_parse_ip_port, 0, offsetof(Geneve, dest_port)
|
||||
GENEVE.FlowLabel, config_parse_geneve_flow_label, 0, 0
|
||||
Tun.OneQueue, config_parse_bool, 0, offsetof(TunTap, one_queue)
|
||||
Tun.MultiQueue, config_parse_bool, 0, offsetof(TunTap, multi_queue)
|
||||
|
@ -271,36 +271,6 @@ int config_parse_port_range(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_destination_port(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
VxLan *v = userdata;
|
||||
uint16_t port;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = parse_ip_port(rvalue, &port);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse VXLAN destination port '%s'.", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
v->dest_port = port;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_flow_label(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
|
@ -86,17 +86,6 @@ int config_parse_port_range(const char *unit,
|
||||
void *data,
|
||||
void *userdata);
|
||||
|
||||
int config_parse_destination_port(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata);
|
||||
|
||||
int config_parse_flow_label(const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
|
@ -960,3 +960,40 @@ int config_parse_ifname(
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_ip_port(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
unsigned line,
|
||||
const char *section,
|
||||
unsigned section_line,
|
||||
const char *lvalue,
|
||||
int ltype,
|
||||
const char *rvalue,
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
uint16_t *s = data;
|
||||
uint16_t port;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*s = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = parse_ip_port(rvalue, &port);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse port '%s'.", rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*s = port;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ int config_parse_log_level(const char *unit, const char *filename, unsigned line
|
||||
int config_parse_signal(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
||||
int config_parse_personality(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
||||
int config_parse_ifname(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
||||
int config_parse_ip_port(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
|
||||
|
||||
#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
|
||||
int function(const char *unit, \
|
||||
|
Loading…
Reference in New Issue
Block a user