On Thu, Sep 26, 2019 at 03:54:32PM +0200, Miroslav Lichvar wrote:
> Don't require each port to have its own master table specified in the
> config. Instead of ports claming configured tables, clone the table in
> each port, so different ports don't interfere with each other.
I'd like to tack on this delta with error path cleanups.
Can you please check it for me?
---
diff --git a/port.c b/port.c
index 1f23fe1..3528219 100644
--- a/port.c
+++ b/port.c
@@ -3039,20 +3039,20 @@ struct port *port_open(int phc_index,
}
if (unicast_client_enabled(p) &&
config_set_section_int(cfg, p->name, "hybrid_e2e", 1)) {
- goto err_transport;
+ goto err_uc_client;
}
if (number && unicast_service_initialize(p)) {
- goto err_transport;
+ goto err_uc_client;
}
p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e");
if (number && type == CLOCK_TYPE_P2P && p->delayMechanism != DM_P2P) {
pr_err("port %d: P2P TC needs P2P ports", number);
- goto err_transport;
+ goto err_uc_service;
}
if (number && type == CLOCK_TYPE_E2E && p->delayMechanism != DM_E2E) {
pr_err("port %d: E2E TC needs E2E ports", number);
- goto err_transport;
+ goto err_uc_service;
}
if (p->hybrid_e2e && p->delayMechanism != DM_E2E) {
pr_warning("port %d: hybrid_e2e only works with E2E", number);
@@ -3078,7 +3078,7 @@ struct port *port_open(int phc_index,
config_get_int(cfg, p->name,
"delay_filter_length"));
if (!p->tsproc) {
pr_err("Failed to create time stamp processor");
- goto err_transport;
+ goto err_uc_service;
}
p->nrate.ratio = 1.0;
@@ -3095,6 +3095,10 @@ struct port *port_open(int phc_index,
err_tsproc:
tsproc_destroy(p->tsproc);
+err_uc_client:
+ unicast_client_cleanup(p);
+err_uc_service:
+ unicast_service_cleanup(p);
err_transport:
transport_destroy(p->trp);
err_port:
diff --git a/unicast_client.c b/unicast_client.c
index f41e59b..67e50ce 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -373,6 +373,7 @@ int unicast_client_initialize(struct port *p)
table->peer_name, &peer->address)) {
pr_err("port %d: bad peer address: %s",
portnum(p), table->peer_name);
+ free_master_table(table);
return -1;
}
STAILQ_FOREACH(master, &table->addrs, list) {
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel