This patch allows to set interface name in 'iface:bind' format where:
- 'iface' is network interface that supports PTP
- 'bind' is network interface to bind socket
This feature can be useful if you have one physical network interface that
serves two or more logical local networks separated with VLAN tags. If you
have to serve PTP clients on both of this local networks you need to bind
to different interfaces representing different VLANs.
Most part of this patch just adjusting code where we read configuration
for interface so we can set different settings for 'eth0:vlan1' and
'eth0:vlan2', for example.
Signed-off-by: Zaripov Kamil
---
.gitignore| 1 +
clock.c | 22 +--
config.c | 8 ++--
interface.c | 34 +++--
interface.h | 14 +++
port.c| 95 ---
port_private.h| 1 +
raw.c | 12 --
udp.c | 8 ++--
udp6.c| 10 +++--
unicast_client.c | 4 +-
unicast_service.c | 6 +--
12 files changed, 134 insertions(+), 81 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1e7d1ca..8d3e171 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@
/snmp4lptp
/timemaster
/ts2phc
+/tz2alt
diff --git a/clock.c b/clock.c
index 75d7c40..b79fa68 100644
--- a/clock.c
+++ b/clock.c
@@ -1182,14 +1182,14 @@ struct clock *clock_create(enum clock_type type, struct
config *config,
if (interface_tsinfo_valid(iface) &&
!interface_tsmodes_supported(iface,
required_modes)) {
pr_err("interface '%s' does not support requested
timestamping mode",
- interface_name(iface));
+ interface_name_full(iface));
return NULL;
}
}
iface = STAILQ_FIRST(>interfaces);
- conf_phc_index = config_get_int(config, interface_name(iface),
"phc_index");
+ conf_phc_index = config_get_int(config, interface_name_full(iface),
"phc_index");
/* determine PHC Clock index */
if (config_get_int(config, NULL, "free_running")) {
@@ -1232,38 +1232,38 @@ struct clock *clock_create(enum clock_type type, struct
config *config,
uds_ifname = config_get_string(config, NULL, "uds_address");
c->uds_rw_if = interface_create(uds_ifname);
- if (config_set_section_int(config, interface_name(c->uds_rw_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_rw_if),
"announceReceiptTimeout", 0)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_rw_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_rw_if),
"delay_mechanism", DM_AUTO)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_rw_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_rw_if),
"network_transport", TRANS_UDS)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_rw_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_rw_if),
"delay_filter_length", 1)) {
return NULL;
}
uds_ifname = config_get_string(config, NULL, "uds_ro_address");
c->uds_ro_if = interface_create(uds_ifname);
- if (config_set_section_int(config, interface_name(c->uds_ro_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_ro_if),
"announceReceiptTimeout", 0)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_ro_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_ro_if),
"delay_mechanism", DM_AUTO)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_ro_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_ro_if),
"network_transport", TRANS_UDS)) {
return NULL;
}
- if (config_set_section_int(config, interface_name(c->uds_ro_if),
+ if (config_set_section_int(config, interface_name_full(c->uds_ro_if),
"delay_filter_length", 1)) {
return NULL;
}
@@ -1414,7 +1414,7 @@ struct clock *clock_create(enum clock_type type, struct
config *config,
/* Create the ports. */
STAILQ_FOREACH(iface, >interfaces, list) {
if (clock_add_port(c, phc_device, phc_index, timestamping,
iface)) {
- pr_err("failed to open port %s", interface_name(iface));
+