config: convert 'udp6_scope' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-15 18:53:43 +02:00
parent 0bb690c16c
commit 6fa42d3491
5 changed files with 3 additions and 17 deletions

View File

@ -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;

View File

@ -67,7 +67,6 @@ struct config {
unsigned char *ptp_dst_mac;
unsigned char *p2p_dst_mac;
unsigned char *udp6_scope;
char *uds_address;
};

View File

@ -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,

5
udp6.c
View File

@ -30,6 +30,7 @@
#include <unistd.h>
#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;

6
udp6.h
View File

@ -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.