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 <zaripov-ka...@avride.ai> --- .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(&config->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, &config->interfaces, list) { if (clock_add_port(c, phc_device, phc_index, timestamping, iface)) { - pr_err("failed to open port %s", interface_name(iface)); + pr_err("failed to open port %s", interface_name_full(iface)); return NULL; } } diff --git a/config.c b/config.c index cb4421f..1ca5040 100644 --- a/config.c +++ b/config.c @@ -840,14 +840,14 @@ int config_read(const char *name, struct config *cfg) if (parse_setting_line(line, &option, &value)) { fprintf(stderr, "could not parse line %d in %s section\n", line_num, current_section == GLOBAL_SECTION ? - "global" : interface_name(current_port)); + "global" : interface_name_full(current_port)); goto parse_error; } check_deprecated_options(&option); parser_res = parse_item(cfg, 0, current_section == GLOBAL_SECTION ? - NULL : interface_name(current_port), + NULL : interface_name_full(current_port), option, value); switch (parser_res) { case PARSED_OK: @@ -856,7 +856,7 @@ int config_read(const char *name, struct config *cfg) fprintf(stderr, "unknown option %s at line %d in %s section\n", option, line_num, current_section == GLOBAL_SECTION ? "global" : - interface_name(current_port)); + interface_name_full(current_port)); goto parse_error; case BAD_VALUE: fprintf(stderr, "%s is a bad value for option %s at line %d\n", @@ -889,7 +889,7 @@ struct interface *config_create_interface(const char *name, struct config *cfg) /* only create each interface once (by name) */ STAILQ_FOREACH(iface, &cfg->interfaces, list) { - ifname = interface_name(iface); + ifname = interface_name_full(iface); if (0 == strncmp(name, ifname, MAX_IFNAME_SIZE)) return iface; } diff --git a/interface.c b/interface.c index 29229ad..3531535 100644 --- a/interface.c +++ b/interface.c @@ -11,6 +11,8 @@ struct interface { STAILQ_ENTRY(interface) list; char name[MAX_IFNAME_SIZE + 1]; char ts_label[MAX_IFNAME_SIZE + 1]; + char bind[MAX_IFNAME_SIZE + 1]; + char name_full[2 * MAX_IFNAME_SIZE + 2]; struct sk_ts_info ts_info; struct sk_if_info if_info; int vclock; @@ -19,13 +21,30 @@ struct interface { struct interface *interface_create(const char *name) { struct interface *iface; + char *ptr; + int name_len; iface = calloc(1, sizeof(struct interface)); if (!iface) { return NULL; } - strncpy(iface->name, name, MAX_IFNAME_SIZE); - strncpy(iface->ts_label, name, MAX_IFNAME_SIZE); + + strncpy(iface->name_full, name, 2 * MAX_IFNAME_SIZE + 2); + if ((ptr = strchr(name, ':'))) { + if (ptr - name > MAX_IFNAME_SIZE) { + name_len = MAX_IFNAME_SIZE; + } else { + name_len = ptr - name; + } + + strncpy(iface->name, name, name_len); + iface->name[name_len] = 0; + strncpy(iface->bind, ptr + 1, MAX_IFNAME_SIZE); + } else { + strncpy(iface->name, name, MAX_IFNAME_SIZE); + strncpy(iface->bind, name, MAX_IFNAME_SIZE); + } + iface->vclock = -1; return iface; @@ -56,12 +75,21 @@ bool interface_ifinfo_valid(struct interface *iface) return iface->if_info.valid ? true : false; } - const char *interface_name(struct interface *iface) { return iface->name; } +const char *interface_bind(struct interface *iface) +{ + return iface->bind; +} + +const char *interface_name_full(struct interface *iface) +{ + return iface->name_full; +} + int interface_phc_index(struct interface *iface) { return iface->ts_info.phc_index; diff --git a/interface.h b/interface.h index 0873bba..2cd4ebf 100644 --- a/interface.h +++ b/interface.h @@ -63,6 +63,20 @@ const char *interface_label(struct interface *iface); */ const char *interface_name(struct interface *iface); +/** + * Obtains the name of a network interface to bind. + * @param iface The interface of interest. + * @return The device name of the network interface to bind. + */ +const char *interface_bind(struct interface *iface); + +/** + * Obtains the full name of a network interface (inteface + ":" + interface to bind). + * @param iface The interface of interest. + * @return The full device name of the network interface. + */ +const char *interface_name_full(struct interface *iface); + /** * Obtains the index of a PTP Hardware Clock device from a network interface. * @param iface The interface of interest. diff --git a/port.c b/port.c index 3453716..cd9b043 100644 --- a/port.c +++ b/port.c @@ -1897,36 +1897,36 @@ int port_initialize(struct port *p) p->multiple_seq_pdr_count = 0; p->multiple_pdr_detected = 0; p->last_fault_type = FT_UNSPECIFIED; - p->logMinDelayReqInterval = config_get_int(cfg, p->name, "logMinDelayReqInterval"); + p->logMinDelayReqInterval = config_get_int(cfg, p->name_full, "logMinDelayReqInterval"); p->peerMeanPathDelay = 0; - p->initialLogAnnounceInterval = config_get_int(cfg, p->name, "logAnnounceInterval"); + p->initialLogAnnounceInterval = config_get_int(cfg, p->name_full, "logAnnounceInterval"); p->logAnnounceInterval = p->initialLogAnnounceInterval; - p->inhibit_announce = config_get_int(cfg, p->name, "inhibit_announce"); - p->ignore_source_id = config_get_int(cfg, p->name, "ignore_source_id"); - p->announceReceiptTimeout = config_get_int(cfg, p->name, "announceReceiptTimeout"); - p->syncReceiptTimeout = config_get_int(cfg, p->name, "syncReceiptTimeout"); - p->transportSpecific = config_get_int(cfg, p->name, "transportSpecific"); + p->inhibit_announce = config_get_int(cfg, p->name_full, "inhibit_announce"); + p->ignore_source_id = config_get_int(cfg, p->name_full, "ignore_source_id"); + p->announceReceiptTimeout = config_get_int(cfg, p->name_full, "announceReceiptTimeout"); + p->syncReceiptTimeout = config_get_int(cfg, p->name_full, "syncReceiptTimeout"); + p->transportSpecific = config_get_int(cfg, p->name_full, "transportSpecific"); p->transportSpecific <<= 4; - p->match_transport_specific = !config_get_int(cfg, p->name, "ignore_transport_specific"); - p->localPriority = config_get_int(cfg, p->name, "G.8275.portDS.localPriority"); - p->initialLogSyncInterval = config_get_int(cfg, p->name, "logSyncInterval"); + p->match_transport_specific = !config_get_int(cfg, p->name_full, "ignore_transport_specific"); + p->localPriority = config_get_int(cfg, p->name_full, "G.8275.portDS.localPriority"); + p->initialLogSyncInterval = config_get_int(cfg, p->name_full, "logSyncInterval"); p->logSyncInterval = p->initialLogSyncInterval; - p->operLogSyncInterval = config_get_int(cfg, p->name, "operLogSyncInterval"); - p->logMinPdelayReqInterval = config_get_int(cfg, p->name, "logMinPdelayReqInterval"); + p->operLogSyncInterval = config_get_int(cfg, p->name_full, "operLogSyncInterval"); + p->logMinPdelayReqInterval = config_get_int(cfg, p->name_full, "logMinPdelayReqInterval"); p->logPdelayReqInterval = p->logMinPdelayReqInterval; - p->operLogPdelayReqInterval = config_get_int(cfg, p->name, "operLogPdelayReqInterval"); - p->neighborPropDelayThresh = config_get_int(cfg, p->name, "neighborPropDelayThresh"); - p->min_neighbor_prop_delay = config_get_int(cfg, p->name, "min_neighbor_prop_delay"); - p->delay_response_timeout = config_get_int(cfg, p->name, "delay_response_timeout"); - p->iface_rate_tlv = config_get_int(cfg, p->name, "interface_rate_tlv"); + p->operLogPdelayReqInterval = config_get_int(cfg, p->name_full, "operLogPdelayReqInterval"); + p->neighborPropDelayThresh = config_get_int(cfg, p->name_full, "neighborPropDelayThresh"); + p->min_neighbor_prop_delay = config_get_int(cfg, p->name_full, "min_neighbor_prop_delay"); + p->delay_response_timeout = config_get_int(cfg, p->name_full, "delay_response_timeout"); + p->iface_rate_tlv = config_get_int(cfg, p->name_full, "interface_rate_tlv"); - if (config_get_int(cfg, p->name, "asCapable") == AS_CAPABLE_TRUE) { + if (config_get_int(cfg, p->name_full, "asCapable") == AS_CAPABLE_TRUE) { p->asCapable = ALWAYS_CAPABLE; } else { p->asCapable = NOT_CAPABLE; } - p->inhibit_delay_req = config_get_int(cfg, p->name, "inhibit_delay_req"); + p->inhibit_delay_req = config_get_int(cfg, p->name_full, "inhibit_delay_req"); if (p->inhibit_delay_req && p->asCapable != ALWAYS_CAPABLE) { pr_err("inhibit_delay_req can only be set when asCapable == 'true'."); return -1; @@ -3297,7 +3297,8 @@ struct port *port_open(const char *phc_device, TAILQ_INIT(&p->tc_transmitted); p->name = interface_name(interface); - if (asprintf(&p->log_name, "port %d (%s)", number, p->name) == -1) { + p->name_full = interface_name_full(interface); + if (asprintf(&p->log_name, "port %d (%s)", number, p->name_full) == -1) { p->log_name = NULL; goto err_port; } @@ -3320,14 +3321,14 @@ struct port *port_open(const char *phc_device, goto err_log_name; } - p->phc_index = config_get_int(cfg, interface_name(interface), "phc_index"); + p->phc_index = config_get_int(cfg, p->name_full, "phc_index"); if (p->phc_index < 0) p->phc_index = phc_index; - p->jbod = config_get_int(cfg, interface_name(interface), "boundary_clock_jbod"); - p->master_only = config_get_int(cfg, interface_name(interface), "serverOnly"); - p->bmca = config_get_int(cfg, interface_name(interface), "BMCA"); + p->jbod = config_get_int(cfg, p->name_full, "boundary_clock_jbod"); + p->master_only = config_get_int(cfg, p->name_full, "serverOnly"); + p->bmca = config_get_int(cfg, p->name_full, "BMCA"); p->trp = transport_create(cfg, config_get_int(cfg, - interface_name(interface), "network_transport")); + p->name_full, "network_transport")); if (!p->trp) { goto err_log_name; } @@ -3375,18 +3376,18 @@ struct port *port_open(const char *phc_device, } p->iface = interface; - p->asymmetry = config_get_int(cfg, p->name, "delayAsymmetry"); + p->asymmetry = config_get_int(cfg, p->name_full, "delayAsymmetry"); p->asymmetry <<= 16; p->announce_span = port_is_uds(p) ? 0 : ANNOUNCE_SPAN; - p->follow_up_info = config_get_int(cfg, p->name, "follow_up_info"); - p->freq_est_interval = config_get_int(cfg, p->name, "freq_est_interval"); - p->msg_interval_request = config_get_int(cfg, p->name, "msg_interval_request"); - p->net_sync_monitor = config_get_int(cfg, p->name, "net_sync_monitor"); - p->path_trace_enabled = config_get_int(cfg, p->name, "path_trace_enabled"); - p->tc_spanning_tree = config_get_int(cfg, p->name, "tc_spanning_tree"); - p->rx_timestamp_offset = config_get_int(cfg, p->name, "ingressLatency"); + p->follow_up_info = config_get_int(cfg, p->name_full, "follow_up_info"); + p->freq_est_interval = config_get_int(cfg, p->name_full, "freq_est_interval"); + p->msg_interval_request = config_get_int(cfg, p->name_full, "msg_interval_request"); + p->net_sync_monitor = config_get_int(cfg, p->name_full, "net_sync_monitor"); + p->path_trace_enabled = config_get_int(cfg, p->name_full, "path_trace_enabled"); + p->tc_spanning_tree = config_get_int(cfg, p->name_full, "tc_spanning_tree"); + p->rx_timestamp_offset = config_get_int(cfg, p->name_full, "ingressLatency"); p->rx_timestamp_offset <<= 16; - p->tx_timestamp_offset = config_get_int(cfg, p->name, "egressLatency"); + p->tx_timestamp_offset = config_get_int(cfg, p->name_full, "egressLatency"); p->tx_timestamp_offset <<= 16; p->link_status = LINK_UP; p->clock = clock; @@ -3394,31 +3395,31 @@ struct port *port_open(const char *phc_device, p->portIdentity.clockIdentity = clock_identity(clock); p->portIdentity.portNumber = number; p->state = PS_INITIALIZING; - p->delayMechanism = config_get_int(cfg, p->name, "delay_mechanism"); + p->delayMechanism = config_get_int(cfg, p->name_full, "delay_mechanism"); p->versionNumber = PTP_MAJOR_VERSION; p->pwr.version = - config_get_int(cfg, p->name, "power_profile.version"); + config_get_int(cfg, p->name_full, "power_profile.version"); p->pwr.grandmasterID = - config_get_int(cfg, p->name, "power_profile.grandmasterID"); + config_get_int(cfg, p->name_full, "power_profile.grandmasterID"); p->pwr.grandmasterTimeInaccuracy = - config_get_int(cfg, p->name, "power_profile.2011.grandmasterTimeInaccuracy"); + config_get_int(cfg, p->name_full, "power_profile.2011.grandmasterTimeInaccuracy"); p->pwr.networkTimeInaccuracy = - config_get_int(cfg, p->name, "power_profile.2011.networkTimeInaccuracy"); + config_get_int(cfg, p->name_full, "power_profile.2011.networkTimeInaccuracy"); p->pwr.totalTimeInaccuracy = - config_get_int(cfg, p->name, "power_profile.2017.totalTimeInaccuracy"); + config_get_int(cfg, p->name_full, "power_profile.2017.totalTimeInaccuracy"); p->slave_event_monitor = clock_slave_monitor(clock); if (!port_is_uds(p) && unicast_client_initialize(p)) { goto err_transport; } if (unicast_client_enabled(p) && - config_set_section_int(cfg, p->name, "hybrid_e2e", 1)) { + config_set_section_int(cfg, p->name_full, "hybrid_e2e", 1)) { goto err_uc_client; } if (!port_is_uds(p) && unicast_service_initialize(p)) { goto err_uc_client; } - p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e"); + p->hybrid_e2e = config_get_int(cfg, p->name_full, "hybrid_e2e"); if (!port_is_uds(p) && type == CLOCK_TYPE_P2P && p->delayMechanism != DM_P2P) { @@ -3444,14 +3445,14 @@ struct port *port_open(const char *phc_device, } p->flt_interval_pertype[FT_BAD_PEER_NETWORK].type = FTMO_LINEAR_SECONDS; p->flt_interval_pertype[FT_BAD_PEER_NETWORK].val = - config_get_int(cfg, p->name, "fault_badpeernet_interval"); + config_get_int(cfg, p->name_full, "fault_badpeernet_interval"); p->flt_interval_pertype[FT_UNSPECIFIED].val = - config_get_int(cfg, p->name, "fault_reset_interval"); + config_get_int(cfg, p->name_full, "fault_reset_interval"); - p->tsproc = tsproc_create(config_get_int(cfg, p->name, "tsproc_mode"), - config_get_int(cfg, p->name, "delay_filter"), - config_get_int(cfg, p->name, "delay_filter_length")); + p->tsproc = tsproc_create(config_get_int(cfg, p->name_full, "tsproc_mode"), + config_get_int(cfg, p->name_full, "delay_filter"), + config_get_int(cfg, p->name_full, "delay_filter_length")); if (!p->tsproc) { pr_err("Failed to create time stamp processor"); goto err_uc_service; diff --git a/port_private.h b/port_private.h index 3b02d2f..538d04f 100644 --- a/port_private.h +++ b/port_private.h @@ -63,6 +63,7 @@ struct tc_txd { struct port { LIST_ENTRY(port) list; const char *name; + const char *name_full; char *log_name; struct interface *iface; struct clock *clock; diff --git a/raw.c b/raw.c index a76fab6..008f582 100644 --- a/raw.c +++ b/raw.c @@ -321,15 +321,19 @@ static int raw_open(struct transport *t, struct interface *iface, unsigned char p2p_dst_mac[MAC_LEN]; int efd, gfd, socket_priority; const char *name; + const char *name_full; + const char *bind; char *str; name = interface_label(iface); - str = config_get_string(t->cfg, name, "ptp_dst_mac"); + name_full = interface_name_full(iface); + bind = interface_bind(iface); + str = config_get_string(t->cfg, name_full, "ptp_dst_mac"); if (str2mac(str, ptp_dst_mac)) { pr_err("invalid ptp_dst_mac %s", str); return -1; } - str = config_get_string(t->cfg, name, "p2p_dst_mac"); + str = config_get_string(t->cfg, name_full, "p2p_dst_mac"); if (str2mac(str, p2p_dst_mac)) { pr_err("invalid p2p_dst_mac %s", str); return -1; @@ -342,11 +346,11 @@ static int raw_open(struct transport *t, struct interface *iface, socket_priority = config_get_int(t->cfg, "global", "socket_priority"); - efd = open_socket(name, 1, ptp_dst_mac, p2p_dst_mac, socket_priority); + efd = open_socket(bind, 1, ptp_dst_mac, p2p_dst_mac, socket_priority); if (efd < 0) goto no_event; - gfd = open_socket(name, 0, ptp_dst_mac, p2p_dst_mac, socket_priority); + gfd = open_socket(bind, 0, ptp_dst_mac, p2p_dst_mac, socket_priority); if (gfd < 0) goto no_general; diff --git a/udp.c b/udp.c index 7c9402e..a512c43 100644 --- a/udp.c +++ b/udp.c @@ -155,10 +155,12 @@ static int udp_open(struct transport *t, struct interface *iface, { struct udp *udp = container_of(t, struct udp, t); const char *name = interface_name(iface); + const char *name_full = interface_name_full(iface); + const char *bind = interface_bind(iface); uint8_t event_dscp, general_dscp; int efd, gfd, ttl; - ttl = config_get_int(t->cfg, name, "udp_ttl"); + ttl = config_get_int(t->cfg, name_full, "udp_ttl"); udp->mac.len = 0; sk_interface_macaddr(name, &udp->mac); @@ -171,11 +173,11 @@ static int udp_open(struct transport *t, struct interface *iface, if (!inet_aton(PTP_PDELAY_MCAST_IPADDR, &mcast_addr[MC_PDELAY])) return -1; - efd = open_socket(name, mcast_addr, EVENT_PORT, ttl); + efd = open_socket(bind, mcast_addr, EVENT_PORT, ttl); if (efd < 0) goto no_event; - gfd = open_socket(name, mcast_addr, GENERAL_PORT, ttl); + gfd = open_socket(bind, mcast_addr, GENERAL_PORT, ttl); if (gfd < 0) goto no_general; diff --git a/udp6.c b/udp6.c index bde1710..abf96f7 100644 --- a/udp6.c +++ b/udp6.c @@ -165,10 +165,12 @@ static int udp6_open(struct transport *t, struct interface *iface, { struct udp6 *udp6 = container_of(t, struct udp6, t); const char *name = interface_name(iface); + const char *name_full = interface_name_full(iface); + const char *bind = interface_bind(iface); uint8_t event_dscp, general_dscp; int efd, gfd, hop_limit; - hop_limit = config_get_int(t->cfg, name, "udp_ttl"); + hop_limit = config_get_int(t->cfg, name_full, "udp_ttl"); udp6->mac.len = 0; sk_interface_macaddr(name, &udp6->mac); @@ -179,19 +181,19 @@ static int udp6_open(struct transport *t, struct interface *iface, &udp6->mc6_addr[MC_PRIMARY])) return -1; - udp6->mc6_addr[MC_PRIMARY].s6_addr[1] = config_get_int(t->cfg, name, + udp6->mc6_addr[MC_PRIMARY].s6_addr[1] = config_get_int(t->cfg, name_full, "udp6_scope"); if (1 != inet_pton(AF_INET6, PTP_PDELAY_MCAST_IP6ADDR, &udp6->mc6_addr[MC_PDELAY])) return -1; - efd = open_socket_ipv6(name, udp6->mc6_addr, EVENT_PORT, &udp6->index, + efd = open_socket_ipv6(bind, udp6->mc6_addr, EVENT_PORT, &udp6->index, hop_limit); if (efd < 0) goto no_event; - gfd = open_socket_ipv6(name, udp6->mc6_addr, GENERAL_PORT, &udp6->index, + gfd = open_socket_ipv6(bind, udp6->mc6_addr, GENERAL_PORT, &udp6->index, hop_limit); if (gfd < 0) goto no_general; diff --git a/unicast_client.c b/unicast_client.c index 0843554..5469854 100644 --- a/unicast_client.c +++ b/unicast_client.c @@ -373,7 +373,7 @@ int unicast_client_initialize(struct port *p) struct unicast_master_table *table; int table_id; - table_id = config_get_int(cfg, p->name, "unicast_master_table"); + table_id = config_get_int(cfg, p->name_full, "unicast_master_table"); if (!table_id) { return 0; } @@ -415,7 +415,7 @@ int unicast_client_initialize(struct port *p) table->port = portnum(p); p->unicast_master_table = table; p->unicast_req_duration = - config_get_int(cfg, p->name, "unicast_req_duration"); + config_get_int(cfg, p->name_full, "unicast_req_duration"); return 0; } diff --git a/unicast_service.c b/unicast_service.c index 687468c..30d119b 100644 --- a/unicast_service.c +++ b/unicast_service.c @@ -442,10 +442,10 @@ int unicast_service_initialize(struct port *p) { struct config *cfg = clock_config(p->clock); - if (!config_get_int(cfg, p->name, "unicast_listen")) { + if (!config_get_int(cfg, p->name_full, "unicast_listen")) { return 0; } - if (config_set_section_int(cfg, p->name, "hybrid_e2e", 1)) { + if (config_set_section_int(cfg, p->name_full, "hybrid_e2e", 1)) { return -1; } p->unicast_service = calloc(1, sizeof(*p->unicast_service)); @@ -460,7 +460,7 @@ int unicast_service_initialize(struct port *p) return -1; } p->inhibit_multicast_service = - config_get_int(cfg, p->name, "inhibit_multicast_service"); + config_get_int(cfg, p->name_full, "inhibit_multicast_service"); return 0; } -- 2.30.1 (Apple Git-130) _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel