1 #include "configuration.h"
6 #include "networkInterfaces.h"
9 #include "olsr_types.h"
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
20 #include <sys/socket.h>
22 #include <nmea/util.h>
29 Determine the address of the port in an OLSR socket address
32 The IP version (AF_INET or AF_INET6)
34 A pointer to OLSR socket address
36 A pointer to the location where the pointer to the port will be stored
38 static void getOlsrSockaddrPortAddress(int ipVersion,
39 union olsr_sockaddr * addr, in_port_t ** port) {
40 if (ipVersion == AF_INET) {
41 *port = &addr->in4.sin_port;
43 *port = &addr->in6.sin6_port;
48 Get pointers to the IP address and port in an OLSR socket address
50 The IP version (AF_INET or AF_INET6)
52 A pointer to OLSR socket address
54 A pointer to the location where the pointer to the IP address will be stored
56 A pointer to the location where the pointer to the port will be stored
58 static void getOlsrSockAddrAndPortAddresses(int ipVersion,
59 union olsr_sockaddr * addr, void ** ipAddress, in_port_t ** port) {
60 if (ipVersion == AF_INET) {
61 *ipAddress = (void *) &addr->in4.sin_addr;
62 *port = (void *) &addr->in4.sin_port;
64 *ipAddress = (void *) &addr->in6.sin6_addr;
65 *port = (void *) &addr->in6.sin6_port;
70 Read an unsigned long long number from a value string
75 the string to convert to a number
77 a pointer to the location where to store the number upon successful conversion
83 static bool readULL(const char * valueName, const char * value,
84 unsigned long long * valueNumber) {
86 unsigned long long valueNew;
89 valueNew = strtoull(value, &endPtr, 10);
91 if (!((endPtr != value) && (*value != '\0') && (*endPtr == '\0'))) {
92 /* invalid conversion */
93 pudError(true, "Configured %s (%s) could not be converted to a number",
98 *valueNumber = valueNew;
104 Read a double number from a value string
107 the name of the value
109 the string to convert to a number
111 a pointer to the location where to store the number upon successful conversion
117 static bool readDouble(const char * valueName, const char * value,
118 double * valueNumber) {
119 char * endPtr = NULL;
123 valueNew = strtod(value, &endPtr);
125 if (!((endPtr != value) && (*value != '\0') && (*endPtr == '\0'))) {
126 /* invalid conversion */
127 pudError(true, "Configured %s (%s) could not be converted to a number",
132 *valueNumber = valueNew;
141 /** The nodeIdType */
142 static NodeIdType nodeIdType = PUD_NODE_ID_TYPE_DEFAULT;
148 NodeIdType getNodeIdTypeNumber(void) {
153 Set the node ID type.
156 The value of the node ID type to set (a number in string representation)
163 - true when an error is detected
166 int setNodeIdType(const char *value, void *data __attribute__ ((unused)),
167 set_plugin_parameter_addon addon __attribute__ ((unused))) {
168 static const char * valueName = PUD_NODE_ID_TYPE_NAME;
169 unsigned long long nodeIdTypeNew;
171 assert (value != NULL);
173 if (!readULL(valueName, value, &nodeIdTypeNew)) {
177 if (!isValidNodeIdType(nodeIdTypeNew)) {
178 pudError(false, "Configured %s (%llu) is reserved", valueName,
183 nodeIdType = nodeIdTypeNew;
192 /** The maximum length of a nodeId */
193 #define PUD_NODEIDMAXLENGTH 255
196 The type that is used to store the nodeId as a binary representation
198 typedef union _nodeIdBinaryType {
199 unsigned long long longValue;
200 unsigned char stringValue[PUD_NODEIDMAXLENGTH + 1];
201 union olsr_ip_addr ip;
202 unsigned char mac[PUD_NODEIDTYPE_MAC_BYTES];
205 /** The nodeId buffer */
206 static unsigned char nodeId[PUD_NODEIDMAXLENGTH + 1];
208 /** The length of the string in the nodeId buffer */
209 static size_t nodeIdLength = 0;
211 /** True when the nodeId is set */
212 static bool nodeIdSet = false;
214 /** The nodeId as a binary representation */
215 static nodeIdBinaryType nodeIdBinary;
217 /** True when the nodeIdBinary is set */
218 static bool nodeIdBinarySet = false;
224 unsigned char * getNodeId(void) {
225 return getNodeIdWithLength(NULL);
229 Get the nodeId and its length
232 a pointer to the variable in which to store the nodeId length (allowed to be
233 NULL, in which case the length is not stored)
238 unsigned char * getNodeIdWithLength(size_t *length) {
240 setNodeId("", NULL, (set_plugin_parameter_addon) {.pc = NULL});
243 if (length != NULL) {
244 *length = nodeIdLength;
254 The value of the node ID to set (in string representation)
261 - true when an error is detected
264 int setNodeId(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
265 static const char * valueName = PUD_NODE_ID_NAME;
268 assert (value != NULL);
270 valueLength = strlen(value);
271 if (valueLength > PUD_NODEIDMAXLENGTH) {
272 pudError(false, "Configured %s is too long, maximum length is"
273 " %u, current length is %lu", valueName, PUD_NODEIDMAXLENGTH,
274 (unsigned long) valueLength);
278 strcpy((char *) &nodeId[0], value);
279 nodeIdLength = valueLength;
290 Validate whether the configured nodeId is valid w.r.t. the configured
291 nodeIdType, for types that are MAC addresses
297 static bool setupNodeIdBinaryMAC(void) {
298 unsigned char * mac = getMainIpMacAddress();
303 memcpy(&nodeIdBinary.mac, mac, PUD_NODEIDTYPE_MAC_BYTES);
304 nodeIdBinarySet = true;
306 if (setupNodeIdBinaryBufferForOlsrCache(mac, PUD_NODEIDTYPE_MAC_BYTES)) {
310 pudError(false, "%s value \"MAC address\" could not be setup", PUD_NODE_ID_NAME);
315 Validate whether the configured nodeId is valid w.r.t. the configured
316 nodeIdType, for types that fit in an unsigned long long (64 bits)
323 the number of bytes in the buffer
329 static bool setupNodeIdBinaryLongLong(unsigned long long min,
330 unsigned long long max, unsigned int bytes) {
331 if (!nodeIdBinarySet) {
332 if (!readULL(PUD_NODE_ID_NAME, (char *) &nodeId[0],
333 &nodeIdBinary.longValue)) {
336 nodeIdBinarySet = true;
339 if ((nodeIdBinary.longValue < min) || (nodeIdBinary.longValue > max)) {
340 pudError(false, "%s value %llu is out of range [%llu,%llu]",
341 PUD_NODE_ID_NAME, nodeIdBinary.longValue, min, max);
345 if (setupNodeIdBinaryLongForOlsrCache(nodeIdBinary.longValue, bytes)) {
353 Validate whether the configured nodeId is valid w.r.t. the configured
354 nodeIdType, for types that are strings
360 static bool setupNodeIdBinaryString(void) {
364 char * nodeid = (char *)getNodeIdWithLength(&nodeidlength);
366 invalidChars = nmea_string_has_invalid_chars(nodeid,
367 PUD_NODE_ID_NAME, &report[0], sizeof(report));
369 pudError(false, &report[0]);
373 if (nodeidlength > PUD_NODEIDMAXLENGTH) {
374 pudError(false, "%s value \"%s\" is too long", PUD_NODE_ID_NAME, &nodeid[0]);
378 /* including trailing \0 */
379 memcpy(&nodeIdBinary.stringValue[0], &nodeid[0], nodeidlength + 1);
380 nodeIdBinarySet = true;
382 /* including trailing \0 */
383 if (setupNodeIdBinaryBufferForOlsrCache(&nodeid[0], nodeidlength + 1)) {
387 pudError(false, "%s value \"%s\" is too long", PUD_NODE_ID_NAME, &nodeid[0]);
392 Validate whether the configured nodeId is valid w.r.t. the configured
399 static bool setupNodeIdBinaryAndValidate(NodeIdType nodeIdTypeNumber) {
400 switch (nodeIdTypeNumber) {
401 case PUD_NODEIDTYPE_MAC: /* hardware address */
402 return setupNodeIdBinaryMAC();
404 case PUD_NODEIDTYPE_MSISDN: /* an MSISDN number */
405 return setupNodeIdBinaryLongLong(0LL, 999999999999999LL,
406 PUD_NODEIDTYPE_MSISDN_BYTES);
408 case PUD_NODEIDTYPE_TETRA: /* a Tetra number */
409 return setupNodeIdBinaryLongLong(0LL, 99999999999999999LL,
410 PUD_NODEIDTYPE_TETRA_BYTES);
412 case PUD_NODEIDTYPE_DNS: /* DNS name */
413 return setupNodeIdBinaryString();
415 case PUD_NODEIDTYPE_MMSI: /* an AIS MMSI number */
416 return setupNodeIdBinaryLongLong(0LL, 999999999LL,
417 PUD_NODEIDTYPE_MMSI_BYTES);
419 case PUD_NODEIDTYPE_URN: /* a URN number */
420 return setupNodeIdBinaryLongLong(0LL, 16777215LL,
421 PUD_NODEIDTYPE_URN_BYTES);
423 case PUD_NODEIDTYPE_192:
424 return setupNodeIdBinaryLongLong(0LL, 9999999LL,
425 PUD_NODEIDTYPE_192_BYTES);
427 case PUD_NODEIDTYPE_193:
428 return setupNodeIdBinaryLongLong(0LL, 999999LL,
429 PUD_NODEIDTYPE_193_BYTES);
431 case PUD_NODEIDTYPE_194:
432 return setupNodeIdBinaryLongLong(1LL, 8191LL, PUD_NODEIDTYPE_194_BYTES);
434 case PUD_NODEIDTYPE_IPV4: /* IPv4 address */
435 case PUD_NODEIDTYPE_IPV6: /* IPv6 address */
436 default: /* unsupported */
437 if (olsr_cnf->ip_version == AF_INET) {
438 memcpy(&nodeIdBinary.ip, &olsr_cnf->main_addr.v4, sizeof(olsr_cnf->main_addr.v4));
439 nodeIdBinarySet = true;
440 if (setupNodeIdBinaryBufferForOlsrCache(&olsr_cnf->main_addr.v4, sizeof(olsr_cnf->main_addr.v4))) {
444 memcpy(&nodeIdBinary.ip, &olsr_cnf->main_addr.v6, sizeof(olsr_cnf->main_addr.v6));
445 nodeIdBinarySet = true;
446 if (setupNodeIdBinaryBufferForOlsrCache(&olsr_cnf->main_addr.v6, sizeof(olsr_cnf->main_addr.v6))) {
451 pudError(false, "%s value \"OLSRd main IP address\" could not be setup", PUD_NODE_ID_NAME);
462 /** The maximum number of RX non-OLSR interfaces */
463 #define PUD_RX_NON_OLSR_IF_MAX 32
465 /** Array with RX non-OLSR interface names */
466 static unsigned char rxNonOlsrInterfaceNames[PUD_RX_NON_OLSR_IF_MAX][IFNAMSIZ + 1];
468 /** The number of RX non-OLSR interface names in the array */
469 static unsigned int rxNonOlsrInterfaceCount = 0;
472 Determine whether a give interface name is configured as a receive non-OLSR
476 The interface name to check
479 - true when the given interface name is configured as a receive non-OLSR
483 bool isRxNonOlsrInterface(const char *ifName) {
486 assert (ifName != NULL);
488 for (i = 0; i < rxNonOlsrInterfaceCount; i++) {
489 if (strncmp((char *) &rxNonOlsrInterfaceNames[i][0], ifName, IFNAMSIZ
499 Add a receive non-OLSR interface
502 The name of the non-OLSR interface to add
509 - true when an error is detected
512 int addRxNonOlsrInterface(const char *value, void *data __attribute__ ((unused)),
513 set_plugin_parameter_addon addon __attribute__ ((unused))) {
514 unsigned long valueLength;
516 assert (value != NULL);
518 valueLength = strlen(value);
519 if (valueLength > IFNAMSIZ) {
520 pudError(false, "Configured %s (%s) is too long,"
521 " maximum length is %u, current length is %lu",
522 PUD_RX_NON_OLSR_IF_NAME, value, IFNAMSIZ, valueLength);
526 if (!isRxNonOlsrInterface(value)) {
527 if (rxNonOlsrInterfaceCount >= PUD_RX_NON_OLSR_IF_MAX) {
528 pudError(false, "Can't configure more than %u receive interfaces",
529 PUD_RX_NON_OLSR_IF_MAX);
533 strcpy((char *) &rxNonOlsrInterfaceNames[rxNonOlsrInterfaceCount][0],
535 rxNonOlsrInterfaceCount++;
542 * rxAllowedSourceIpAddress
545 /** The maximum number of RX allowed source IP addresses */
546 #define PUD_RX_ALLOWED_SOURCE_IP_MAX 32
548 /** Array with RX allowed source IP addresses */
549 static struct sockaddr rxAllowedSourceIpAddresses[PUD_RX_ALLOWED_SOURCE_IP_MAX];
551 /** The number of RX allowed source IP addresses in the array */
552 static unsigned int rxAllowedSourceIpAddressesCount = 0;
555 Determine whether a give IP address is configured as an allowed source IP
559 The IP address to check
562 - true when the given IP address is configured as an allowed source IP
566 bool isRxAllowedSourceIpAddress(struct sockaddr * sender) {
568 unsigned int addrSize;
571 if (rxAllowedSourceIpAddressesCount == 0) {
575 if (sender == NULL) {
579 if (sender->sa_family == AF_INET) {
580 addr = (void *) (&((struct sockaddr_in *) sender)->sin_addr);
581 addrSize = sizeof(struct in_addr);
583 addr = (void *) (&((struct sockaddr_in6 *) sender)->sin6_addr);
584 addrSize = sizeof(struct in6_addr);
587 for (i = 0; i < rxAllowedSourceIpAddressesCount; i++) {
588 if ((rxAllowedSourceIpAddresses[i].sa_family == sender->sa_family)
589 && (memcmp(&rxAllowedSourceIpAddresses[i].sa_data, addr,
599 Set the RX allowed source IP addresses.
602 The RX allowed source IP address (in string representation)
609 - true when an error is detected
612 int addRxAllowedSourceIpAddress(const char *value, void *data __attribute__ ((unused)),
613 set_plugin_parameter_addon addon __attribute__ ((unused))) {
614 static const char * valueName = PUD_RX_ALLOWED_SOURCE_IP_NAME;
615 const char * valueInternal = value;
617 struct sockaddr addr;
619 assert (value != NULL);
621 memset(&addr, 0, sizeof(addr));
623 addr.sa_family = olsr_cnf->ip_version;
624 conversion = inet_pton(olsr_cnf->ip_version, valueInternal, &addr.sa_data);
625 if (conversion != 1) {
626 pudError((conversion == -1) ? true : false,
627 "Configured %s (%s) is not an IP address", valueName,
632 if ((rxAllowedSourceIpAddressesCount == 0) || !isRxAllowedSourceIpAddress(&addr)) {
633 if (rxAllowedSourceIpAddressesCount >= PUD_RX_ALLOWED_SOURCE_IP_MAX) {
634 pudError(false, "Can't configure more than %u allowed source IP"
635 " addresses", PUD_RX_ALLOWED_SOURCE_IP_MAX);
639 memcpy(&rxAllowedSourceIpAddresses[rxAllowedSourceIpAddressesCount],
640 &addr, sizeof(addr));
641 rxAllowedSourceIpAddressesCount++;
651 /** The rx multicast address */
652 static union olsr_sockaddr rxMcAddr;
654 /** True when the rx multicast address is set */
655 static bool rxMcAddrSet = false;
659 The receive multicast address (in network byte order). Sets both the address
660 and the port to their default values when the address was not yet set.
662 union olsr_sockaddr * getRxMcAddr(void) {
664 setRxMcAddr(NULL, NULL, ((set_plugin_parameter_addon) {.pc = NULL}));
670 Set the receive multicast address. Sets the address to its default value when
671 the value is NULL. Also sets the port to its default value when the address
675 The receive multicast address (in string representation)
682 - true when an error is detected
685 int setRxMcAddr(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
686 static const char * valueName = PUD_RX_MC_ADDR_NAME;
689 const char * valueInternal = value;
692 getOlsrSockAddrAndPortAddresses(olsr_cnf->ip_version, &rxMcAddr, &ipAddress,
694 if (olsr_cnf->ip_version == AF_INET) {
695 rxMcAddr.in4.sin_family = olsr_cnf->ip_version;
696 if (valueInternal == NULL) {
697 valueInternal = PUD_RX_MC_ADDR_4_DEFAULT;
700 rxMcAddr.in6.sin6_family = olsr_cnf->ip_version;
701 if (valueInternal == NULL) {
702 valueInternal = PUD_RX_MC_ADDR_6_DEFAULT;
707 *port = htons(PUD_RX_MC_PORT_DEFAULT);
710 conversion = inet_pton(olsr_cnf->ip_version, valueInternal, ipAddress);
711 if (conversion != 1) {
712 pudError((conversion == -1) ? true : false,
713 "Configured %s (%s) is not an IP address", valueName,
718 if (!isMulticast(olsr_cnf->ip_version, &rxMcAddr)) {
719 pudError(false, "Configured %s (%s) is not a multicast address",
720 valueName, valueInternal);
734 The receive multicast port (in network byte order)
736 unsigned short getRxMcPort(void) {
738 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, getRxMcAddr(), &port);
743 Set the receive multicast port
746 The receive multicast port (a number in string representation)
753 - true when an error is detected
756 int setRxMcPort(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
757 static const char * valueName = PUD_RX_MC_PORT_NAME;
758 unsigned long long rxMcPortNew;
760 union olsr_sockaddr * addr = getRxMcAddr();
762 assert (value != NULL);
764 if (!readULL(valueName, value, &rxMcPortNew)) {
768 if ((rxMcPortNew < 1) || (rxMcPortNew > 65535)) {
769 pudError(false, "Configured %s (%llu) is outside of"
770 " valid range 1-65535", valueName, rxMcPortNew);
774 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, addr, &port);
775 *port = htons((uint16_t) rxMcPortNew);
784 /** The maximum number of rx non-olsr interfaces */
785 #define PUD_TX_NON_OLSR_IF_MAX 32
787 /** Array with tx non-olsr interface names */
788 static unsigned char txNonOlsrInterfaceNames[PUD_TX_NON_OLSR_IF_MAX][IFNAMSIZ + 1];
790 /** The number of tx interface names in the array */
791 static unsigned int txNonOlsrInterfaceCount = 0;
794 Determine whether a give interface name is configured as a transmit non-OLSR
798 The interface to check
801 - true when the given interface name is configured as a transmit non-OLSR
805 bool isTxNonOlsrInterface(const char *ifName) {
808 assert (ifName != NULL);
810 for (i = 0; i < txNonOlsrInterfaceCount; i++) {
811 if (strncmp((char *) &txNonOlsrInterfaceNames[i][0], ifName, IFNAMSIZ
821 Add a transmit non-OLSR interface
824 The name of the non-OLSR interface to add
831 - true when an error is detected
834 int addTxNonOlsrInterface(const char *value, void *data __attribute__ ((unused)),
835 set_plugin_parameter_addon addon __attribute__ ((unused))) {
836 unsigned long valueLength;
838 assert (value != NULL);
840 valueLength = strlen(value);
841 if (valueLength > IFNAMSIZ) {
842 pudError(false, "Configured %s (%s) is too long,"
843 " maximum length is %u, current length is %lu",
844 PUD_TX_NON_OLSR_IF_NAME, value, IFNAMSIZ, valueLength);
848 if (!isTxNonOlsrInterface(value)) {
849 if (txNonOlsrInterfaceCount >= PUD_TX_NON_OLSR_IF_MAX) {
850 pudError(false, "Can not configure more than %u transmit"
851 " interfaces", PUD_TX_NON_OLSR_IF_MAX);
855 strcpy((char *) &txNonOlsrInterfaceNames[txNonOlsrInterfaceCount][0],
857 txNonOlsrInterfaceCount++;
867 /** The tx multicast address */
868 static union olsr_sockaddr txMcAddr;
870 /** True when the tx multicast address is set */
871 static bool txMcAddrSet = false;
875 The transmit multicast address (in network byte order). Sets both the address
876 and the port to their default values when the address was not yet set.
878 union olsr_sockaddr * getTxMcAddr(void) {
880 setTxMcAddr(NULL, NULL, ((set_plugin_parameter_addon) {.pc = NULL}));
886 Set the transmit multicast address. Sets the address to its default value when
887 the value is NULL. Also sets the port to its default value when the address
891 The transmit multicast address (in string representation)
898 - true when an error is detected
901 int setTxMcAddr(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
902 static const char * valueName = PUD_TX_MC_ADDR_NAME;
905 const char * valueInternal = value;
908 getOlsrSockAddrAndPortAddresses(olsr_cnf->ip_version, &txMcAddr, &ipAddress,
910 if (olsr_cnf->ip_version == AF_INET) {
911 txMcAddr.in4.sin_family = olsr_cnf->ip_version;
912 if (valueInternal == NULL) {
913 valueInternal = PUD_TX_MC_ADDR_4_DEFAULT;
916 txMcAddr.in6.sin6_family = olsr_cnf->ip_version;
917 if (valueInternal == NULL) {
918 valueInternal = PUD_TX_MC_ADDR_6_DEFAULT;
923 *port = htons(PUD_TX_MC_PORT_DEFAULT);
926 conversion = inet_pton(olsr_cnf->ip_version, valueInternal, ipAddress);
927 if (conversion != 1) {
928 pudError((conversion == -1) ? true : false,
929 "Configured %s (%s) is not an IP address", valueName,
934 if (!isMulticast(olsr_cnf->ip_version, &txMcAddr)) {
935 pudError(false, "Configured %s (%s) is not a multicast address",
936 valueName, valueInternal);
950 The transmit multicast port (in network byte order)
952 unsigned short getTxMcPort(void) {
954 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, getTxMcAddr(), &port);
959 Set the transmit multicast port
962 The transmit multicast port (a number in string representation)
969 - true when an error is detected
972 int setTxMcPort(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
973 static const char * valueName = PUD_TX_MC_PORT_NAME;
974 unsigned long long txMcPortNew;
976 union olsr_sockaddr * addr = getTxMcAddr();
978 assert (value != NULL);
980 if (!readULL(valueName, value, &txMcPortNew)) {
984 if ((txMcPortNew < 1) || (txMcPortNew > 65535)) {
985 pudError(false, "Configured %s (%llu) is outside of"
986 " valid range 1-65535", valueName, txMcPortNew);
990 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, addr, &port);
991 *port = htons((uint16_t) txMcPortNew);
1000 /** The uplink address */
1001 static union olsr_sockaddr uplinkAddr;
1003 /** True when the uplink address is set */
1004 static bool uplinkAddrSet = false;
1006 /** True when the uplink address is set */
1007 static bool uplinkPortSet = false;
1011 - true when the uplink address is set
1014 bool isUplinkAddrSet(void) {
1015 return uplinkAddrSet;
1020 The uplink address (in network byte order). Sets both the address
1021 and the port to their default values when the address was not yet set.
1023 union olsr_sockaddr * getUplinkAddr(void) {
1024 if (!uplinkAddrSet) {
1025 setUplinkAddr(NULL, NULL, ((set_plugin_parameter_addon) {.pc = NULL}));
1031 Set the uplink address. Sets the address to its default value when
1032 the value is NULL. Also sets the port to its default value when the address
1036 The uplink address (in string representation)
1043 - true when an error is detected
1046 int setUplinkAddr(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
1047 static const char * valueName = PUD_UPLINK_ADDR_NAME;
1050 const char * valueInternal = value;
1052 bool defaultValue = false;
1054 getOlsrSockAddrAndPortAddresses(olsr_cnf->ip_version, &uplinkAddr,
1056 if (olsr_cnf->ip_version == AF_INET) {
1057 uplinkAddr.in4.sin_family = olsr_cnf->ip_version;
1058 if (valueInternal == NULL) {
1059 valueInternal = PUD_UPLINK_ADDR_4_DEFAULT;
1060 defaultValue = true;
1063 uplinkAddr.in6.sin6_family = olsr_cnf->ip_version;
1064 if (valueInternal == NULL) {
1065 valueInternal = PUD_UPLINK_ADDR_6_DEFAULT;
1066 defaultValue = true;
1070 if (!uplinkPortSet) {
1071 *port = htons(PUD_UPLINK_PORT_DEFAULT);
1072 uplinkPortSet = true;
1075 conversion = inet_pton(olsr_cnf->ip_version, valueInternal, ipAddress);
1076 if (conversion != 1) {
1077 pudError((conversion == -1) ? true : false,
1078 "Configured %s (%s) is not an IP address", valueName,
1083 if (!defaultValue) {
1084 uplinkAddrSet = true;
1096 The uplink port (in network byte order)
1098 unsigned short getUplinkPort(void) {
1100 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, getUplinkAddr(), &port);
1108 The uplink port (a number in string representation)
1115 - true when an error is detected
1118 int setUplinkPort(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
1119 static const char * valueName = PUD_UPLINK_PORT_NAME;
1120 unsigned long long uplinkPortNew;
1122 union olsr_sockaddr * addr = getUplinkAddr();
1124 assert (value != NULL);
1126 if (!readULL(valueName, value, &uplinkPortNew)) {
1130 if ((uplinkPortNew < 1) || (uplinkPortNew > 65535)) {
1131 pudError(false, "Configured %s (%llu) is outside of"
1132 " valid range 1-65535", valueName, uplinkPortNew);
1136 getOlsrSockaddrPortAddress(olsr_cnf->ip_version, addr, &port);
1137 *port = htons((uint16_t) uplinkPortNew);
1138 uplinkPortSet = true;
1148 /** the downlink port */
1149 unsigned short downlinkPort = 0;
1151 /** true when the downlinkPort is set */
1152 bool downlinkPortSet = false;
1156 The downlink port (in network byte order)
1158 unsigned short getDownlinkPort(void) {
1159 if (!downlinkPortSet) {
1160 downlinkPort = htons(PUD_DOWNLINK_PORT_DEFAULT);
1161 downlinkPortSet = true;
1164 return downlinkPort;
1168 Set the downlink port
1171 The downlink port (a number in string representation)
1178 - true when an error is detected
1181 int setDownlinkPort(const char *value, void *data __attribute__ ((unused)),
1182 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1183 static const char * valueName = PUD_DOWNLINK_PORT_NAME;
1184 unsigned long long downlinkPortNew;
1186 assert(value != NULL);
1188 if (!readULL(valueName, value, &downlinkPortNew)) {
1192 if ((downlinkPortNew < 1) || (downlinkPortNew > 65535)) {
1193 pudError(false, "Configured %s (%llu) is outside of"
1194 " valid range 1-65535", valueName, downlinkPortNew);
1198 downlinkPort = htons(downlinkPortNew);
1199 downlinkPortSet = true;
1209 static unsigned char txTtl = PUD_TX_TTL_DEFAULT;
1213 The transmit multicast IP packet time-to-live
1215 unsigned char getTxTtl(void) {
1220 Set the transmit multicast IP packet time-to-live
1223 The transmit multicast IP packet time-to-live (a number in string representation)
1230 - true when an error is detected
1233 int setTxTtl(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
1234 static const char * valueName = PUD_TX_TTL_NAME;
1235 unsigned long long txTtlNew;
1237 assert (value != NULL);
1239 if (!readULL(valueName, value, &txTtlNew)) {
1243 if ((txTtlNew < 1) || (txTtlNew > MAX_TTL)) {
1244 pudError(false, "Configured %s (%llu) is outside of"
1245 " valid range 1-%u", valueName, txTtlNew, MAX_TTL);
1255 * txNmeaMessagePrefix
1258 /** The exact length of the tx NMEA message prefix */
1259 #define PUD_TXNMEAMESSAGEPREFIXLENGTH 4
1261 /** The tx NMEA message prefix buffer */
1262 static unsigned char txNmeaMessagePrefix[PUD_TXNMEAMESSAGEPREFIXLENGTH + 1];
1264 /** True when the tx NMEA message prefix is set */
1265 static bool txNmeaMessagePrefixSet = false;
1269 The transmit multicast NMEA message prefix
1271 unsigned char * getTxNmeaMessagePrefix(void) {
1272 if (!txNmeaMessagePrefixSet) {
1273 setTxNmeaMessagePrefix(PUD_TX_NMEAMESSAGEPREFIX_DEFAULT, NULL,
1274 (set_plugin_parameter_addon) {.pc = NULL});
1276 return &txNmeaMessagePrefix[0];
1280 Set the transmit multicast NMEA message prefix
1283 The transmit multicast NMEA message prefix (in string representation)
1290 - true when an error is detected
1293 int setTxNmeaMessagePrefix(const char *value, void *data __attribute__ ((unused)),
1294 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1295 static const char * valueName = PUD_TX_NMEAMESSAGEPREFIX_NAME;
1300 assert (value != NULL);
1302 valueLength = strlen(value);
1303 if (valueLength != PUD_TXNMEAMESSAGEPREFIXLENGTH) {
1304 pudError(false, "Configured %s (%s) must be %u exactly characters",
1305 valueName, value, PUD_TXNMEAMESSAGEPREFIXLENGTH);
1309 invalidChars = nmea_string_has_invalid_chars(value, valueName, &report[0],
1312 pudError(false, &report[0]);
1316 if ((strchr(value, ' ') != NULL) || (strchr(value, '\t') != NULL)) {
1317 pudError(false, "Configured %s (%s) can not contain whitespace",
1322 strcpy((char *) &txNmeaMessagePrefix[0], value);
1323 txNmeaMessagePrefixSet = true;
1332 static unsigned char olsrTtl = PUD_OLSR_TTL_DEFAULT;
1336 The OLSR multicast IP packet time-to-live
1338 unsigned char getOlsrTtl(void) {
1343 Set the OLSR multicast IP packet time-to-live
1346 The OLSR multicast IP packet time-to-live (a number in string representation)
1353 - true when an error is detected
1356 int setOlsrTtl(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused))) {
1357 static const char * valueName = PUD_OLSR_TTL_NAME;
1358 unsigned long long olsrTtlNew;
1360 assert (value != NULL);
1362 if (!readULL(valueName, value, &olsrTtlNew)) {
1366 if ((olsrTtlNew < 1) || (olsrTtlNew > MAX_TTL)) {
1367 pudError(false, "Configured %s (%llu) is outside of valid range 1-%u",
1368 valueName, olsrTtlNew, MAX_TTL);
1372 olsrTtl = olsrTtlNew;
1378 * updateIntervalStationary
1381 /** The stationary interval update plugin parameter (in seconds) */
1382 static unsigned long long updateIntervalStationary = PUD_UPDATE_INTERVAL_STATIONARY_DEFAULT;
1386 The stationary interval update plugin parameter (in seconds)
1388 unsigned long long getUpdateIntervalStationary(void) {
1389 return updateIntervalStationary;
1393 Set stationary interval update plugin parameter
1396 The stationary interval update plugin parameter (in seconds)
1403 - true when an error is detected
1406 int setUpdateIntervalStationary(const char *value, void *data __attribute__ ((unused)),
1407 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1408 static const char * valueName = PUD_UPDATE_INTERVAL_STATIONARY_NAME;
1409 unsigned long long updateIntervalStationaryNew;
1411 assert (value != NULL);
1413 if (!readULL(valueName, value, &updateIntervalStationaryNew)) {
1417 if (updateIntervalStationaryNew < 1) {
1418 pudError(false, "Configured %s must be at least 1", valueName);
1422 updateIntervalStationary = updateIntervalStationaryNew;
1428 * updateIntervalMoving
1431 /** The moving interval update plugin parameter (in seconds) */
1432 static unsigned long long updateIntervalMoving = PUD_UPDATE_INTERVAL_MOVING_DEFAULT;
1436 The moving interval update plugin parameter (in seconds)
1438 unsigned long long getUpdateIntervalMoving(void) {
1439 return updateIntervalMoving;
1443 Set moving interval update plugin parameter
1446 The moving interval update plugin parameter (in seconds)
1453 - true when an error is detected
1456 int setUpdateIntervalMoving(const char *value, void *data __attribute__ ((unused)),
1457 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1458 static const char * valueName = PUD_UPDATE_INTERVAL_MOVING_NAME;
1459 unsigned long long updateIntervalMovingNew;
1461 assert (value != NULL);
1463 if (!readULL(valueName, value, &updateIntervalMovingNew)) {
1467 if (updateIntervalMovingNew < 1) {
1468 pudError(false, "Configured %s must be at least 1", valueName);
1472 updateIntervalMoving = updateIntervalMovingNew;
1478 * uplinkUpdateIntervalStationary
1481 /** The uplink stationary interval update plugin parameter (in seconds) */
1482 static unsigned long long uplinkUpdateIntervalStationary = PUD_UPLINK_UPDATE_INTERVAL_STATIONARY_DEFAULT;
1486 The uplink stationary interval update plugin parameter (in seconds)
1488 unsigned long long getUplinkUpdateIntervalStationary(void) {
1489 return uplinkUpdateIntervalStationary;
1493 Set uplink stationary interval update plugin parameter
1496 The uplink stationary interval update plugin parameter (in seconds)
1503 - true when an error is detected
1506 int setUplinkUpdateIntervalStationary(const char *value, void *data __attribute__ ((unused)),
1507 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1508 static const char * valueName = PUD_UPLINK_UPDATE_INTERVAL_STATIONARY_NAME;
1509 unsigned long long uplinkUpdateIntervalStationaryNew;
1511 assert (value != NULL);
1513 if (!readULL(valueName, value, &uplinkUpdateIntervalStationaryNew)) {
1517 if (uplinkUpdateIntervalStationaryNew < 1) {
1518 pudError(false, "Configured %s must be at least 1", valueName);
1522 uplinkUpdateIntervalStationary = uplinkUpdateIntervalStationaryNew;
1528 * uplinkUpdateIntervalMoving
1531 /** The uplink moving interval update plugin parameter (in seconds) */
1532 static unsigned long long uplinkUpdateIntervalMoving = PUD_UPLINK_UPDATE_INTERVAL_MOVING_DEFAULT;
1536 The uplink moving interval update plugin parameter (in seconds)
1538 unsigned long long getUplinkUpdateIntervalMoving(void) {
1539 return uplinkUpdateIntervalMoving;
1543 Set uplink moving interval update plugin parameter
1546 The uplink moving interval update plugin parameter (in seconds)
1553 - true when an error is detected
1556 int setUplinkUpdateIntervalMoving(const char *value, void *data __attribute__ ((unused)),
1557 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1558 static const char * valueName = PUD_UPLINK_UPDATE_INTERVAL_MOVING_NAME;
1559 unsigned long long uplinkUpdateIntervalMovingNew;
1561 assert (value != NULL);
1563 if (!readULL(valueName, value, &uplinkUpdateIntervalMovingNew)) {
1567 if (uplinkUpdateIntervalMovingNew < 1) {
1568 pudError(false, "Configured %s must be at least 1", valueName);
1572 uplinkUpdateIntervalMoving = uplinkUpdateIntervalMovingNew;
1578 * movingSpeedThreshold
1581 /** The moving speed threshold plugin parameter (in kph) */
1582 static unsigned long long movingSpeedThreshold = PUD_MOVING_SPEED_THRESHOLD_DEFAULT;
1586 The moving speed threshold plugin parameter (in kph)
1588 unsigned long long getMovingSpeedThreshold(void) {
1589 return movingSpeedThreshold;
1593 Set moving speed threshold plugin parameter
1596 The moving speed threshold plugin parameter (in kph)
1603 - true when an error is detected
1606 int setMovingSpeedThreshold(const char *value, void *data __attribute__ ((unused)),
1607 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1608 static const char * valueName = PUD_MOVING_SPEED_THRESHOLD_NAME;
1609 unsigned long long movingSpeedThresholdNew;
1611 assert (value != NULL);
1613 if (!readULL(valueName, value, &movingSpeedThresholdNew)) {
1617 movingSpeedThreshold = movingSpeedThresholdNew;
1623 * movingDistanceThreshold
1626 /** The moving distance threshold plugin parameter (in meters) */
1627 static unsigned long long movingDistanceThreshold = PUD_MOVING_DISTANCE_THRESHOLD_DEFAULT;
1631 The moving distance threshold plugin parameter (in meters)
1633 unsigned long long getMovingDistanceThreshold(void) {
1634 return movingDistanceThreshold;
1638 Set moving distance threshold plugin parameter
1641 The moving distance threshold plugin parameter (in meter)
1648 - true when an error is detected
1651 int setMovingDistanceThreshold(const char *value, void *data __attribute__ ((unused)),
1652 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1653 static const char * valueName = PUD_MOVING_DISTANCE_THRESHOLD_NAME;
1654 unsigned long long movingDistanceThresholdNew;
1656 assert (value != NULL);
1658 if (!readULL(valueName, value, &movingDistanceThresholdNew)) {
1662 movingDistanceThreshold = movingDistanceThresholdNew;
1671 /* The DOP multiplier plugin parameter */
1672 static double dopMultiplier = PUD_DOP_MULTIPLIER_DEFAULT;
1676 The DOP multiplier plugin parameter
1678 double getDopMultiplier(void) {
1679 return dopMultiplier;
1683 Set DOP multiplier plugin parameter
1686 The DOP multiplier plugin parameter
1693 - true when an error is detected
1696 int setDopMultiplier(const char *value, void *data __attribute__ ((unused)),
1697 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1698 static const char * valueName = PUD_DOP_MULTIPLIER_NAME;
1699 double dopMultiplierNew;
1701 assert (value != NULL);
1703 if (!readDouble(valueName, value, &dopMultiplierNew)) {
1707 dopMultiplier = dopMultiplierNew;
1716 /** The default HDOP plugin parameter (in meters) */
1717 static unsigned long long defaultHdop = PUD_DEFAULT_HDOP_DEFAULT;
1721 The default HDOP plugin parameter (in meters)
1723 unsigned long long getDefaultHdop(void) {
1728 Set default HDOP plugin parameter
1731 The default HDOP plugin parameter (in meters)
1738 - true when an error is detected
1741 int setDefaultHdop(const char *value, void *data __attribute__ ((unused)),
1742 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1743 static const char * valueName = PUD_MOVING_DISTANCE_THRESHOLD_NAME;
1744 unsigned long long defaultHdopNew;
1746 assert (value != NULL);
1748 if (!readULL(valueName, value, &defaultHdopNew)) {
1752 defaultHdop = defaultHdopNew;
1761 /** The default VDOP plugin parameter (in meters) */
1762 static unsigned long long defaultVdop = PUD_DEFAULT_VDOP_DEFAULT;
1766 The default VDOP plugin parameter (in meters)
1768 unsigned long long getDefaultVdop(void) {
1773 Set default VDOP plugin parameter
1776 The default VDOP plugin parameter (in meters)
1783 - true when an error is detected
1786 int setDefaultVdop(const char *value, void *data __attribute__ ((unused)),
1787 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1788 static const char * valueName = PUD_MOVING_DISTANCE_THRESHOLD_NAME;
1789 unsigned long long defaultVdopNew;
1791 assert (value != NULL);
1793 if (!readULL(valueName, value, &defaultVdopNew)) {
1797 defaultVdop = defaultVdopNew;
1806 /** The depth of the average list */
1807 static unsigned long long averageDepth = PUD_AVERAGE_DEPTH_DEFAULT;
1811 The depth of the average list
1813 unsigned long long getAverageDepth(void) {
1814 return averageDepth;
1818 Set average depth plugin parameter
1821 The average depth plugin parameter
1828 - true when an error is detected
1831 int setAverageDepth(const char *value, void *data __attribute__ ((unused)),
1832 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1833 static const char * valueName = PUD_AVERAGE_DEPTH_NAME;
1834 unsigned long long averageDepthNew;
1836 assert (value != NULL);
1838 if (!readULL(valueName, value, &averageDepthNew)) {
1842 if (averageDepthNew < 1) {
1843 pudError(false, "Configured %s must be at least 1", valueName);
1847 averageDepth = averageDepthNew;
1853 * hysteresisCountToStationary
1856 /** The hysteresis count for changing state from moving to stationary */
1857 static unsigned long long hysteresisCountToStationary = PUD_HYSTERESIS_COUNT_2STAT_DEFAULT;
1861 The hysteresis count for changing state from moving to stationary
1863 unsigned long long getHysteresisCountToStationary(void) {
1864 return hysteresisCountToStationary;
1868 Set hysteresis count plugin parameter
1871 The hysteresis count plugin parameter
1878 - true when an error is detected
1881 int setHysteresisCountToStationary(const char *value, void *data __attribute__ ((unused)),
1882 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1883 static const char * valueName = PUD_HYSTERESIS_COUNT_2STAT_NAME;
1884 unsigned long long hysteresisCountNew;
1886 assert (value != NULL);
1888 if (!readULL(valueName, value, &hysteresisCountNew)) {
1892 hysteresisCountToStationary = hysteresisCountNew;
1898 * hysteresisCountToMoving
1901 /** The hysteresis count for changing state from stationary to moving */
1902 static unsigned long long hysteresisCountToMoving = PUD_HYSTERESIS_COUNT_2MOV_DEFAULT;
1906 The hysteresis count for changing state from stationary to moving
1908 unsigned long long getHysteresisCountToMoving(void) {
1909 return hysteresisCountToMoving;
1913 Set hysteresis count plugin parameter
1916 The hysteresis count plugin parameter
1923 - true when an error is detected
1926 int setHysteresisCountToMoving(const char *value, void *data __attribute__ ((unused)),
1927 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1928 static const char * valueName = PUD_HYSTERESIS_COUNT_2MOV_NAME;
1929 unsigned long long hysteresisCountNew;
1931 assert (value != NULL);
1933 if (!readULL(valueName, value, &hysteresisCountNew)) {
1937 hysteresisCountToMoving = hysteresisCountNew;
1946 /* when true then duplicate message detection is performed */
1947 static bool useDeDup = PUD_USE_DEDUP_DEFAULT;
1951 The duplicate message detection setting
1953 bool getUseDeDup(void) {
1958 Set duplicate message detection setting plugin parameter
1961 The duplicate message detection setting plugin parameter
1968 - true when an error is detected
1971 int setUseDeDup(const char *value, void *data __attribute__ ((unused)),
1972 set_plugin_parameter_addon addon __attribute__ ((unused))) {
1973 static const char * valueName = PUD_USE_DEDUP_NAME;
1974 unsigned long long useDeDupNew;
1976 assert (value != NULL);
1978 if (!readULL(valueName, value, &useDeDupNew)) {
1982 if ((useDeDupNew != 0) && (useDeDupNew != 1)) {
1983 pudError(false, "Configured %s must be 0 (false) or 1 (true)",
1988 useDeDup = (useDeDupNew == 1);
1997 /** The hysteresis count for changing state from stationary to moving */
1998 static unsigned long long deDupDepth = PUD_DEDUP_DEPTH_DEFAULT;
2002 The hysteresis count for changing state from stationary to moving
2004 unsigned long long getDeDupDepth(void) {
2009 Set de-duplication depth plugin parameter
2012 The de-duplication depth plugin parameter
2019 - true when an error is detected
2022 int setDeDupDepth(const char *value, void *data __attribute__ ((unused)),
2023 set_plugin_parameter_addon addon __attribute__ ((unused))) {
2024 static const char * valueName = PUD_DEDUP_DEPTH_NAME;
2025 unsigned long long deDupDepthNew;
2027 assert (value != NULL);
2029 if (!readULL(valueName, value, &deDupDepthNew)) {
2033 deDupDepth = deDupDepthNew;
2042 /* when true then loopback is performed */
2043 static bool useLoopback = PUD_USE_LOOPBACK_DEFAULT;
2047 The loopback usage setting
2049 bool getUseLoopback(void) {
2054 Set loopback usage plugin parameter
2057 The loopback usage plugin parameter
2064 - true when an error is detected
2067 int setUseLoopback(const char *value, void *data __attribute__ ((unused)),
2068 set_plugin_parameter_addon addon __attribute__ ((unused))) {
2069 static const char * valueName = PUD_USE_LOOPBACK_NAME;
2070 unsigned long long useLoopbackNew;
2072 assert (value != NULL);
2074 if (!readULL(valueName, value, &useLoopbackNew)) {
2078 if ((useLoopbackNew != 0) && (useLoopbackNew != 1)) {
2079 pudError(false, "Configured %s must be 0 (false) or 1 (true)",
2084 useLoopback = (useLoopbackNew == 1);
2094 Check the configuration for consistency and validity.
2097 - true when the configuration is consistent and valid
2100 unsigned int checkConfig(void) {
2103 if (!olsr_cnf->smart_gw_active) {
2104 pudError(false, "Smart Gateway must be active");
2108 if (rxNonOlsrInterfaceCount == 0) {
2109 pudError(false, "No receive non-OLSR interfaces configured");
2113 if (txNonOlsrInterfaceCount == 0) {
2114 pudError(false, "No transmit non-OLSR interfaces configured");
2119 if (nodeIdType == PUD_NODEIDTYPE_DNS) {
2120 char name[PUD_NODEIDMAXLENGTH + 1];
2123 if (gethostname(&name[0], sizeof(name)) < 0) {
2124 pudError(true, "Could not get the host name");
2127 setNodeId(&name[0], NULL,
2128 (set_plugin_parameter_addon) {.pc = NULL});
2130 } else if ((nodeIdType != PUD_NODEIDTYPE_MAC) && (nodeIdType
2131 != PUD_NODEIDTYPE_IPV4) && (nodeIdType != PUD_NODEIDTYPE_IPV6)) {
2132 pudError(false, "No node ID set while one is required for"
2133 " node type %u", nodeIdType);
2138 if (!setupNodeIdBinaryAndValidate(nodeIdType)) {
2142 if (updateIntervalMoving > updateIntervalStationary) {
2143 pudError(false,"The update interval for moving situations must not be"
2144 " larger than that for stationary situations");
2148 if (uplinkUpdateIntervalMoving > uplinkUpdateIntervalStationary) {
2149 pudError(false,"The uplink update interval for moving situations must not be"
2150 " larger than that for stationary situations");
2154 if (getUplinkPort() == getDownlinkPort()) {
2155 pudError(false, "The uplink port and the downlink port must not be the same");
2163 Check the configuration for consistency and validity after everything has been
2167 - true when the configuration is consistent and valid
2170 unsigned int checkRunSetup(void) {
2174 /* any receive interface name that is configured but is not the name of an
2175 * actual receive interface is not a valid interface name */
2176 for (i = 0; i < rxNonOlsrInterfaceCount; i++) {
2177 unsigned char * nonOlsrInterfaceName = &rxNonOlsrInterfaceNames[i][0];
2179 TRxTxNetworkInterface * interfaceObject = getRxNetworkInterfaces();
2181 while (interfaceObject != NULL) {
2182 if (strncmp((char *) nonOlsrInterfaceName,
2183 (char *) &interfaceObject->name[0], IFNAMSIZ + 1) == 0) {
2187 interfaceObject = interfaceObject->next;
2190 pudError(false, "Configured receive non-OLSR interface %s is not"
2191 " a known interface name", nonOlsrInterfaceName);
2196 /* any transmit interface name that is configured but is not the name of an
2197 * actual transmit interface is not a valid interface name */
2198 for (i = 0; i < txNonOlsrInterfaceCount; i++) {
2199 unsigned char * nonOlsrInterfaceName = &txNonOlsrInterfaceNames[i][0];
2201 TRxTxNetworkInterface * interfaceObject = getTxNetworkInterfaces();
2203 while (interfaceObject != NULL) {
2204 if (strncmp((char *) nonOlsrInterfaceName,
2205 (char *) &interfaceObject->name[0], IFNAMSIZ + 1) == 0) {
2209 interfaceObject = interfaceObject->next;
2212 pudError(false, "Configured transmit non-OLSR interface %s is not"
2213 " a known interface name", nonOlsrInterfaceName);