diff --git a/config.c b/config.c index e1eac73..1c4421b 100644 --- a/config.c +++ b/config.c @@ -133,6 +133,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("transportSpecific", 0, 0, 0x0F), GLOB_ITEM_INT("tx_timestamp_timeout", 1, 1, INT_MAX), PORT_ITEM_INT("udp_ttl", 1, 1, 255), + PORT_ITEM_INT("udp6_scope", 0x0E, 0x00, 0x0F), GLOB_ITEM_INT("use_syslog", 1, 0, 1), GLOB_ITEM_INT("verbose", 0, 0, 1), }; @@ -464,12 +465,6 @@ static enum parser_result parse_global_setting(const char *option, for (i = 0; i < MAC_LEN; i++) cfg->p2p_dst_mac[i] = mac[i]; - } else if (!strcmp(option, "udp6_scope")) { - r = get_ranged_uint(value, &uval, 0x00, 0x0F); - if (r != PARSED_OK) - return r; - *cfg->udp6_scope = uval; - } else if (!strcmp(option, "uds_address")) { if (strlen(value) > MAX_IFNAME_SIZE) return OUT_OF_RANGE; diff --git a/config.h b/config.h index 88120e4..0ccb3ea 100644 --- a/config.h +++ b/config.h @@ -67,7 +67,6 @@ struct config { unsigned char *ptp_dst_mac; unsigned char *p2p_dst_mac; - unsigned char *udp6_scope; char *uds_address; }; diff --git a/ptp4l.c b/ptp4l.c index 0ddf6c1..08f7512 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -77,7 +77,6 @@ static struct config cfg_settings = { .ptp_dst_mac = ptp_dst_mac, .p2p_dst_mac = p2p_dst_mac, - .udp6_scope = &udp6_scope, .uds_address = uds_path, .cfg_ignore = 0, diff --git a/udp6.c b/udp6.c index f098b8c..fdf5799 100644 --- a/udp6.c +++ b/udp6.c @@ -30,6 +30,7 @@ #include #include "address.h" +#include "config.h" #include "contain.h" #include "print.h" #include "sk.h" @@ -42,8 +43,6 @@ #define PTP_PRIMARY_MCAST_IP6ADDR "FF0E:0:0:0:0:0:0:181" #define PTP_PDELAY_MCAST_IP6ADDR "FF02:0:0:0:0:0:0:6B" -unsigned char udp6_scope = 0x0E; - struct udp6 { struct transport t; int index; @@ -172,7 +171,7 @@ static int udp6_open(struct transport *t, const char *name, struct fdarray *fda, if (1 != inet_pton(AF_INET6, PTP_PRIMARY_MCAST_IP6ADDR, &mc6_addr[MC_PRIMARY])) return -1; - mc6_addr[MC_PRIMARY].s6_addr[1] = udp6_scope; + mc6_addr[MC_PRIMARY].s6_addr[1] = config_get_int(t->cfg, name, "udp6_scope"); if (1 != inet_pton(AF_INET6, PTP_PDELAY_MCAST_IP6ADDR, &mc6_addr[MC_PDELAY])) return -1; diff --git a/udp6.h b/udp6.h index e451262..8613da5 100644 --- a/udp6.h +++ b/udp6.h @@ -23,12 +23,6 @@ #include "fd.h" #include "transport.h" -/** - * The desired scope for the multicast messages. This will be used as - * the second byte of the primary IPv6 address. See RFC 4291. - */ -extern unsigned char udp6_scope; - /** * Allocate an instance of a UDP/IPv6 transport. * @return Pointer to a new transport instance on success, NULL otherwise.