diff --git a/ptp4l.c b/ptp4l.c index c41e642..aad970a 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -27,6 +27,7 @@ #include "print.h" #include "sk.h" #include "transport.h" +#include "util.h" int assume_two_step; double configured_pi_kp, configured_pi_ki; /*see pi.c*/ @@ -38,22 +39,6 @@ static struct defaultDS ds; static struct port_defaults pod; static struct config cfg_settings; -static int generate_clock_identity(struct ClockIdentity *ci, char *name) -{ - unsigned char mac[6]; - if (sk_interface_macaddr(name, mac, sizeof(mac))) - return -1; - ci->id[0] = mac[0]; - ci->id[1] = mac[1]; - ci->id[2] = mac[2]; - ci->id[3] = 0xFF; - ci->id[4] = 0xFE; - ci->id[5] = mac[3]; - ci->id[6] = mac[4]; - ci->id[7] = mac[5]; - return 0; -} - static void usage(char *progname) { fprintf(stderr, diff --git a/util.c b/util.c index f597c49..4f432a6 100644 --- a/util.c +++ b/util.c @@ -18,6 +18,7 @@ */ #include +#include "sk.h" #include "util.h" char *ps_str[] = { @@ -73,3 +74,19 @@ char *pid2str(struct PortIdentity *id) id->portNumber); return buf; } + +int generate_clock_identity(struct ClockIdentity *ci, char *name) +{ + unsigned char mac[6]; + if (sk_interface_macaddr(name, mac, sizeof(mac))) + return -1; + ci->id[0] = mac[0]; + ci->id[1] = mac[1]; + ci->id[2] = mac[2]; + ci->id[3] = 0xFF; + ci->id[4] = 0xFE; + ci->id[5] = mac[3]; + ci->id[6] = mac[4]; + ci->id[7] = mac[5]; + return 0; +} diff --git a/util.h b/util.h index 50b9c7c..d538cce 100644 --- a/util.h +++ b/util.h @@ -54,4 +54,6 @@ char *cid2str(struct ClockIdentity *id); */ char *pid2str(struct PortIdentity *id); +int generate_clock_identity(struct ClockIdentity *ci, char *name); + #endif