Signed-off-by: Richard Cochran <[email protected]>
---
clock.c | 2 +-
port.c | 17 ++++++++++-------
raw.c | 5 +++--
udp.c | 2 +-
udp6.c | 2 +-
5 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/clock.c b/clock.c
index 7d13b3b..66c6bc1 100644
--- a/clock.c
+++ b/clock.c
@@ -962,7 +962,7 @@ struct clock *clock_create(enum clock_type type, struct
config *config,
STAILQ_FOREACH(iface, &config->interfaces, list) {
rtnl_get_ts_device(interface_name(iface), iface->ts_label);
ensure_ts_label(iface);
- sk_get_ts_info(iface->ts_label, &iface->ts_info);
+ sk_get_ts_info(interface_label(iface), &iface->ts_info);
if (iface->ts_info.valid &&
((iface->ts_info.so_timestamping & required_modes) !=
required_modes)) {
pr_err("interface '%s' does not support requested
timestamping mode",
diff --git a/port.c b/port.c
index 6423568..52aef86 100644
--- a/port.c
+++ b/port.c
@@ -792,6 +792,7 @@ static int port_management_fill_response(struct port
*target,
struct management_tlv *tlv;
struct port_ds_np *pdsnp;
struct tlv_extra *extra;
+ const char *ts_label;
struct portDS *pds;
uint16_t u16;
uint8_t *buf;
@@ -941,7 +942,8 @@ static int port_management_fill_response(struct port
*target,
else
ppn->port_state = target->state;
ppn->timestamping = target->timestamping;
- ptp_text_set(&ppn->interface, target->iface->ts_label);
+ ts_label = interface_label(target->iface);
+ ptp_text_set(&ppn->interface, ts_label);
datalen = sizeof(*ppn) + ppn->interface.length;
break;
case TLV_PORT_STATS_NP:
@@ -2482,10 +2484,10 @@ static void bc_dispatch(struct port *p, enum fsm_event
event, int mdiff)
void port_link_status(void *ctx, int linkup, int ts_index)
{
- struct port *p = ctx;
- int link_state;
char ts_label[MAX_IFNAME_SIZE + 1] = {0};
- int required_modes;
+ int link_state, required_modes;
+ const char *old_ts_label;
+ struct port *p = ctx;
link_state = linkup ? LINK_UP : LINK_DOWN;
if (p->link_status & link_state) {
@@ -2496,7 +2498,8 @@ void port_link_status(void *ctx, int linkup, int ts_index)
}
/* ts_label changed */
- if (if_indextoname(ts_index, ts_label) && strcmp(p->iface->ts_label,
ts_label)) {
+ old_ts_label = interface_label(p->iface);
+ if (if_indextoname(ts_index, ts_label) && strcmp(old_ts_label,
ts_label)) {
strncpy(p->iface->ts_label, ts_label, MAX_IFNAME_SIZE);
p->link_status |= TS_LABEL_CHANGED;
pr_notice("port %hu: ts label changed to %s", portnum(p),
ts_label);
@@ -2505,7 +2508,7 @@ void port_link_status(void *ctx, int linkup, int ts_index)
/* Both link down/up and change ts_label may change phc index. */
if (p->link_status & LINK_UP &&
(p->link_status & LINK_STATE_CHANGED || p->link_status &
TS_LABEL_CHANGED)) {
- sk_get_ts_info(p->iface->ts_label, &p->iface->ts_info);
+ sk_get_ts_info(interface_label(p->iface), &p->iface->ts_info);
/* Only switch phc with HW time stamping mode */
if (p->iface->ts_info.valid && p->iface->ts_info.phc_index >=
0) {
@@ -2513,7 +2516,7 @@ void port_link_status(void *ctx, int linkup, int ts_index)
if ((p->iface->ts_info.so_timestamping &
required_modes) != required_modes) {
pr_err("interface '%s' does not support
requested "
"timestamping mode, set link status down
by force.",
- p->iface->ts_label);
+ interface_label(p->iface));
p->link_status = LINK_DOWN | LINK_STATE_CHANGED;
} else if (p->phc_index != p->iface->ts_info.phc_index)
{
p->phc_index = p->iface->ts_info.phc_index;
diff --git a/raw.c b/raw.c
index f1c92b9..81ec431 100644
--- a/raw.c
+++ b/raw.c
@@ -213,9 +213,10 @@ static int raw_open(struct transport *t, struct interface
*iface,
unsigned char ptp_dst_mac[MAC_LEN];
unsigned char p2p_dst_mac[MAC_LEN];
int efd, gfd, socket_priority;
- char *str, *name;
+ const char *name;
+ char *str;
- name = iface->ts_label;
+ name = interface_label(iface);
str = config_get_string(t->cfg, name, "ptp_dst_mac");
if (str2mac(str, ptp_dst_mac)) {
pr_err("invalid ptp_dst_mac %s", str);
diff --git a/udp.c b/udp.c
index 143f714..eb7be78 100644
--- a/udp.c
+++ b/udp.c
@@ -179,7 +179,7 @@ static int udp_open(struct transport *t, struct interface
*iface,
if (gfd < 0)
goto no_general;
- if (sk_timestamping_init(efd, iface->ts_label, ts_type, TRANS_UDP_IPV4))
+ if (sk_timestamping_init(efd, interface_label(iface), ts_type,
TRANS_UDP_IPV4))
goto no_timestamping;
if (sk_general_init(gfd))
diff --git a/udp6.c b/udp6.c
index 6e5f86f..6cb571b 100644
--- a/udp6.c
+++ b/udp6.c
@@ -196,7 +196,7 @@ static int udp6_open(struct transport *t, struct interface
*iface,
if (gfd < 0)
goto no_general;
- if (sk_timestamping_init(efd, iface->ts_label, ts_type, TRANS_UDP_IPV6))
+ if (sk_timestamping_init(efd, interface_label(iface), ts_type,
TRANS_UDP_IPV6))
goto no_timestamping;
if (sk_general_init(gfd))
--
2.20.1
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel