olsr_u8_t get_validity_time_from_hop(struct tlv_tuple *tlv_entry, olsr_u8_t hop_count) { int i = 0; olsr_u8_t vtime; olsr_u8_t *p = tlv_entry->extended_value; while(i < tlv_entry->length -1) { vtime = (olsr_u8_t)me_to_double(*p++); if(hop_count <= *p++){ if(DEBUG_OLSRV2) { olsr_printf("VTIME[%u]\n",vtime); } return vtime; } i += 2; } vtime = (olsr_u8_t)me_to_double(*p); if(DEBUG_OLSRV2) { olsr_printf("VTIME[%u]\n",vtime); } return vtime; }
static int read_uuid_from_file(const char *file) { FILE *f; char* end; *uuid = 0; f = fopen(file, "r"); olsr_printf(1, "(JSONINFO) Reading UUID from '%s'\n", file); if (f == NULL ) { olsr_printf(1, "(JSONINFO) Could not open '%s': %s\n", file, strerror(errno)); return -1; } if (fread(uuid, 1, UUIDLEN, f) > 0) { fclose(f); /* we only use the first line of the file */ end = strchr(uuid, '\n'); if(end) *end = 0; return 0; } else { olsr_printf(1, "(JSONINFO) Could not read UUID from '%s': %s\n", file, strerror(errno)); return -1; } fclose(f); return 1; }
/* ------------------------------------------------------------------------- * Function : BmfPError * Description: Prints an error message at OLSR debug level 1. * First the plug-in name is printed. Then (if format is not NULL * and *format is not empty) the arguments are printed, followed * by a colon and a blank. Then the message and a new-line. * Input : format, arguments * Output : none * Return : none * Data Used : none * ------------------------------------------------------------------------- */ void BmfPError(const char* format, ...) { #define MAX_STR_DESC 255 char* strErr = strerror(errno); char strDesc[MAX_STR_DESC]; /* Rely on short-circuit boolean evaluation */ if (format == NULL || *format == '\0') { olsr_printf(1, "%s: %s\n", PLUGIN_NAME, strErr); } else { va_list arglist; olsr_printf(1, "%s: ", PLUGIN_NAME); va_start(arglist, format); vsnprintf(strDesc, MAX_STR_DESC, format, arglist); va_end(arglist); strDesc[MAX_STR_DESC - 1] = '\0'; /* Ensures null termination */ olsr_printf(1, "%s: %s\n", strDesc, strErr); } } /* BmfPError */
static int read_uuid_from_file(const char *file) { FILE *f; char* end; int r = 0; size_t chars; memset(uuid, 0, sizeof(uuid)); f = fopen(file, "r"); olsr_printf(1, "(JSONINFO) Reading UUID from '%s'\n", file); if (f == NULL ) { olsr_printf(1, "(JSONINFO) Could not open '%s': %s\n", file, strerror(errno)); return -1; } chars = fread(uuid, 1, UUIDLEN, f); if (chars > 0) { uuid[chars] = '\0'; /* null-terminate the string */ /* we only use the first line of the file */ end = strchr(uuid, '\n'); if(end) *end = 0; r = 0; } else { olsr_printf(1, "(JSONINFO) Could not read UUID from '%s': %s\n", file, strerror(errno)); r = -1; } fclose(f); return r; }
//yowada olsr_bool match_local_iface_addr(void *olsr, olsr_ip_addr *neigh_addr) { struct olsrv2* olsr1 = (struct olsrv2* ) olsr; union olsr_ip_addr *local_addr = NULL; int ifnum,i; ifnum = ((struct olsrv2 *)olsr)->iface_num; for (i=0; i < ifnum; i++){ local_addr = &((struct olsrv2 *)olsr)->iface_addr[i]; if (DEBUG_OLSRV2) { if (olsr1->olsr_cnf->ip_version == AF_INET) { char str1[INET_ADDRSTRLEN], str2[INET_ADDRSTRLEN]; ConvertIpv4AddressToString(local_addr->v4, str1); ConvertIpv4AddressToString(neigh_addr->v4, str2); olsr_printf("Local addr %s,\tNeigh addr %s\n",str1, str2); } else if (olsr1->olsr_cnf->ip_version == AF_INET6) { char str1[INET6_ADDRSTRLEN], str2[INET6_ADDRSTRLEN]; ConvertIpv6AddressToString(&local_addr->v6, str1, OLSR_FALSE); ConvertIpv6AddressToString(&neigh_addr->v6, str2, OLSR_FALSE); olsr_printf("Local addr %s,\tNeigh addr %s\n",str1, str2); } } if (equal_ip_addr((struct olsrv2 *)olsr, neigh_addr ,local_addr) == OLSR_TRUE) return OLSR_TRUE; } return OLSR_FALSE; }
static int plugin_ipc_init(void) { struct sockaddr_in sock_in; uint32_t yes = 1; if (ipc_socket != -1) { close(ipc_socket); } /* Init ipc socket */ ipc_socket = socket(AF_INET, SOCK_STREAM, 0); if (ipc_socket == -1) { olsr_printf(1, "(DOT DRAW)IPC socket %s\n", strerror(errno)); return 0; } if (setsockopt(ipc_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) { perror("SO_REUSEADDR failed"); CLOSE(ipc_socket); return 0; } #if (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE if (setsockopt(ipc_socket, SOL_SOCKET, SO_NOSIGPIPE, (char *)&yes, sizeof(yes)) < 0) { perror("SO_REUSEADDR failed"); CLOSE(ipc_socket); return 0; } #endif /* (defined __FreeBSD__ || defined __FreeBSD_kernel__) && defined SO_NOSIGPIPE */ /* Bind the socket */ /* complete the socket structure */ memset(&sock_in, 0, sizeof(sock_in)); sock_in.sin_family = AF_INET; sock_in.sin_addr.s_addr = ipc_listen_ip.v4.s_addr; sock_in.sin_port = htons(ipc_port); /* bind the socket to the port number */ if (bind(ipc_socket, (struct sockaddr *)&sock_in, sizeof(sock_in)) == -1) { olsr_printf(1, "(DOT DRAW)IPC bind %s\n", strerror(errno)); CLOSE(ipc_socket); return 0; } /* show that we are willing to listen */ if (listen(ipc_socket, 1) == -1) { olsr_printf(1, "(DOT DRAW)IPC listen %s\n", strerror(errno)); CLOSE(ipc_socket); return 0; } /* Register with olsrd */ add_olsr_socket(ipc_socket, &ipc_action, NULL, NULL, SP_PR_READ); return 1; }
static void print_message_tlv(struct olsrv2 *olsr) { struct olsrd_config *olsr_cnf = olsr->olsr_cnf; if (olsr_cnf->debug_level < 2) return; struct tlv_tuple *tuple = olsr->message_tlv_entry; olsr_printf("---------------------- = MSG TLV LIST = -----------------\n"); while (tuple != NULL) { olsr_printf("\tTLV TYPE : %s ", olsr_get_msg_tlv_type(tuple->type)); olsr_printf("\tLENGTH : %u ", tuple->length); olsr_printf("\tVALUE: %u\n", tuple->value); if (tuple->length > sizeof(olsr_u32_t)) { olsr_printf("TLV VALUE HAS over 4bytes value\n"); int i; olsr_printf("TLV ExtensionValue["); for (i = 0; i < tuple->length; i++) olsr_printf("%u ", tuple->extended_value[i]); olsr_printf("]\n"); } tuple = tuple->next; } olsr_printf("----------------------------------------------------------\n\n"); return; }
/** *Prints the registered neighbors and two hop neighbors *to STDOUT. * *@return nada */ void print_plc_peer_neighbors(void) { int idx; olsr_printf(1, "\n---IP address ----- PLC MAC ------TX-RATE---RX-RATE-----RAW MODULATION RATE (Mbits/s)\n"); for (idx = 0; idx < HASHSIZE; idx++) { struct plc_peer_entry *entry; for (entry = plc_peer_neighbors[idx].next; entry != &plc_peer_neighbors[idx]; entry = entry->next) { struct ipaddr_str buf; olsr_printf(1, "\n%s---%02X:%02X:%02X:%02X:%02X:%02X ----%d / %d-----%.2f\n", olsr_ip_to_string(&buf, &entry->plc_peer_main_addr), entry->plc_data.mac[0], entry->plc_data.mac[1], entry->plc_data.mac[2], entry->plc_data.mac[3], entry->plc_data.mac[4], entry->plc_data.mac[5], entry->plc_data.tx_rate, entry->plc_data.rx_rate, entry->plc_data.raw_modulation_rate); } } }
void forward_message(struct olsrv2 *olsr) { const struct message_header* m_header = &olsr->message_header; olsr_pktbuf_t* msg = NULL; msg = olsr_pktbuf_alloc(); olsr_pktbuf_clear(msg); /* TC should be forwarded all interface. but now, we forward only one interface. I'll correct later... */ build_message_header(olsr, msg, (olsr_u16_t)olsr->message_body_size, m_header->message_type, &m_header->orig_addr, m_header->ttl - 1, m_header->hop_count + 1, m_header->message_seq_num); if (m_header->message_type == TC_MESSAGE){ olsr->stat.numTcRelayed++; if (DEBUG_OLSRV2){ olsr_printf("Increment TC relayed to %d.\n",olsr->stat.numTcRelayed); } } olsr_pktbuf_append_byte_ary(msg, (olsr_u8_t* )olsr->message_body, olsr->message_body_size); if (DEBUG_OLSRV2){ olsr_printf("TTL:%d\nhopcount:%d\nmsg_size:%d\n",m_header->ttl - 1, m_header->hop_count + 1, (int)msg->len); } if (m_header->message_type == TC_MESSAGE) { int ifNum; for(ifNum=0; ifNum<olsr->iface_num; ifNum++) { set_forward_infomation(olsr, msg->data, (unsigned int)msg->len, (unsigned char)ifNum); } } else { set_forward_infomation(olsr, msg->data, (unsigned int)msg->len, olsr->parsingIfNum); } olsr_pktbuf_free(&msg); }
void print_other_neigh_status(olsr_u8_t other_neigh){ switch(other_neigh) { case SYMMETRIC: olsr_printf("SYMMETRIC "); break; case LOST: olsr_printf("LOST "); break; default: { } //olsr_error("no such link status"); } }
int update_plc_peer_data(struct plc_data * p_data) { struct plc_peer_entry *entry; olsr_printf(3, "olsrd: linklayer_plc_data: lookup di: %02X:%02X:%02X:%02X:%02X:%02X\n", p_data->mac[0], p_data->mac[1], p_data->mac[2], p_data->mac[3], p_data->mac[4], p_data->mac[5]); entry = lookup_plc_peer_by_mac(p_data->mac); if(entry == NULL) return 0; if(entry != NULL) { olsr_printf(3, "olsrd: linklayer_plc_data: Updating PLC MAC: %02X:%02X:%02X:%02X:%02X:%02X with TX_rate: %d - RX_rate: %d\n", entry->plc_data.mac[0], entry->plc_data.mac[1], entry->plc_data.mac[2], entry->plc_data.mac[3], entry->plc_data.mac[4], entry->plc_data.mac[5], p_data->rx_rate, p_data->rx_rate); entry->plc_data.rx_rate = p_data->rx_rate; entry->plc_data.tx_rate = p_data->tx_rate; entry->plc_data.raw_modulation_rate = p_data->raw_modulation_rate; return 1; } }
static void print_new_list(struct olsrv2 *olsr, struct address_list *entry) { struct olsrd_config *olsr_cnf = olsr->olsr_cnf; if (olsr_cnf->debug_level < 5) return; olsr_printf("\t\t ---------- ONE ADDR INFO ------\n"); char* paddr = olsr_niigata_ip_to_string(olsr, &entry->ip_addr); olsr_printf("IP_ADDRESS[%s]\n", paddr); free(paddr); olsr_printf("\t\tINDEX[%u]\n", entry->index); return; }
/** *Constructor */ static void my_init(void) { /* Print plugin info to stdout */ olsr_printf(0, "%s (%s)\n", PLUGIN_TITLE, git_descriptor); info_plugin_config_init(&config, 9090); memset(uuidfile, 0, sizeof(uuidfile)); }
/** Report a plugin error. @param useErrno when true then errno is used in the error message; the error reason is also reported. @param format a pointer to the format string @param ... arguments to the format string */ void pudError(bool useErrno, const char *format, ...) { char strDesc[256]; const char *colon; const char *stringErr; if ((format == NULL) || (*format == '\0')) { strDesc[0] = '\0'; colon = ""; if (!useErrno) { stringErr = "Unknown error"; } else { stringErr = strerror(errno); } } else { va_list arglist; va_start(arglist, format); vsnprintf(strDesc, sizeof(strDesc), format, arglist); va_end(arglist); if (useErrno) { colon = ": "; stringErr = strerror(errno); } else { colon = ""; stringErr = ""; } } if (!pudErrorUseSysLog) olsr_printf(0, "%s: %s%s%s\n", PUD_PLUGIN_ABBR, strDesc, colon, stringErr); else olsr_syslog(OLSR_LOG_ERR, "%s: %s%s%s\n", PUD_PLUGIN_ABBR, strDesc, colon, stringErr); }
static void olsr_check_changes(struct olsrv2 *olsr) { if (olsr->change_adv_neigh_set == OLSR_TRUE && olsr->adv_neigh_set.head == NULL && olsr->attached_net_addr == NULL) { //I should send additional TC message, now! //but that code will write later. olsr->I_am_MPR_flag = OLSR_FALSE; } if(olsr->change_adv_neigh_set) { increment_local_assn(olsr); if (DEBUG_OLSRV2){ olsr_printf("Increase ASSN number to %d.\n", olsr->assn); } } //struct olsrv2 if (olsr->change_two_neigh_set == OLSR_TRUE || olsr->change_link_set == OLSR_TRUE) { olsr->changes_neighborhood = OLSR_TRUE; } if (olsr->change_topology_set == OLSR_TRUE || olsr->change_attached_set == OLSR_TRUE) { olsr->changes_topology = OLSR_TRUE; } flash_change_flags(olsr); }
static char * get_address_block_header(struct olsrv2* olsr, struct address_block_info *info, char *msg_ptr) { olsr_u8_t head_octet, tail_octet; msg_ptr = get_u8(msg_ptr, &info->num_addr); // check head_length & no_tail bit msg_ptr = get_u8(msg_ptr, &head_octet); info->head_length = head_octet & GET_HEAD_LENGTH; info->no_tail = (head_octet & NO_TAIL) != 0 ? 1 : 0; // get head memset(&info->head, 0 , sizeof(union olsr_ip_addr)); msg_ptr = get_bytes(msg_ptr, info->head_length, &info->head); //check invalid info if(info->head_length > olsr->olsr_cnf->ipsize) olsr_printf("\n\tWarning : [length is too long (%u) ] %s(%u)\n", info->head_length, __FUNCTION__, __LINE__); //check tail part if(info->no_tail == 0){ // contains tail msg_ptr = get_u8(msg_ptr, &tail_octet); info->tail_length = tail_octet & GET_TAIL_LENGTH; info->zero_tail = (tail_octet & ZERO_TAIL) != 0 ? 1 : 0; //get tail memset(&info->tail, 0, sizeof(union olsr_ip_addr)); if(info->zero_tail == 0) msg_ptr = get_bytes(msg_ptr, info->tail_length, &info->tail); //check invalid info if(info->tail_length > olsr->olsr_cnf->ipsize) olsr_printf("\n\tWarning : [length is too long (%u) ] %s(%u)\n", info->head_length, __FUNCTION__, __LINE__); }else{ // not includes tail info->tail_length = 0; info->zero_tail = 1; } //mid_length info->mid_length = (olsr_u8_t)olsr->olsr_cnf->ipsize - info->head_length - info->tail_length; return msg_ptr; }
/* ------------------------------------------------------------------------- * Function : my_init * Description: Plugin constructor * Input : none * Output : none * Return : none * Data Used : none * Notes : Called at load of shared object * ------------------------------------------------------------------------- */ static void my_init(void) { /* Print plugin info to stdout */ olsr_printf(0, "%s (%s)\n", PLUGIN_NAME, git_descriptor); return; }
void olsr_exit(const char *msg, int val) { fflush(stdout); exit_value = val; olsr_printf("%s",msg); raise(SIGTERM); }
static int add_plugin_ipnet(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused))) { char sz_net[100], sz_mask[100]; /* IPv6 in the future */ if(sscanf(value, "%99s %99s", sz_net, sz_mask) != 2) { olsr_printf(1, "(HTTPINFO) Error parsing net param \"%s\"!\n", value); return 0; } return insert_plugin_ipnet(sz_net, sz_mask, data); }
void insert_routing_set(struct olsrv2 *olsr, union olsr_ip_addr *dest_iface_addr, const union olsr_ip_addr *next_iface_addr, olsr_u8_t prefix_length, olsr_u16_t dist, const union olsr_ip_addr *iface_addr) { OLSR_ROUTING_TUPLE data; //Multi path check if (OLSR_TRUE) { if (search_routing_set_for_dest_exist(olsr, dest_iface_addr) == OLSR_TRUE ||//yowada add match_local_iface_addr(olsr, dest_iface_addr) == OLSR_TRUE) { if (DEBUG_OLSRV2) { char* paddr = olsr_niigata_ip_to_string(olsr, dest_iface_addr); olsr_printf("Route %s has already exist! hopcount = %d\n",paddr,dist); free(paddr); } return; //olsr_error("Multi path!!\n"); } } //Fix for Solaris //data.R_dest_iface_addr = *dest_iface_addr; //data.R_next_iface_addr = *next_iface_addr; olsr_ip_copy(olsr, &data.R_dest_iface_addr, dest_iface_addr); olsr_ip_copy(olsr, &data.R_next_iface_addr, next_iface_addr); data.R_prefix_length = prefix_length; data.R_dist = dist; //data.R_iface_addr = *iface_addr; olsr_ip_copy(olsr, &data.R_iface_addr, iface_addr); /* assert(equal_ip_addr(olsr_cnf->ip_version, data.R_dest_iface_addr, data.R_iface_addr) == OLSR_FALSE); */ if (equal_ip_addr(olsr, &data.R_dest_iface_addr, &data.R_iface_addr)) { return; } OLSR_InsertList(&olsr->routing_set[olsr_hashing(olsr,&data.R_dest_iface_addr)].list, &data, sizeof(OLSR_ROUTING_TUPLE)); /* OLSR_InsertList_Sort(&olsr->routing_set, */ /* &data, */ /* sizeof(OLSR_ROUTING_TUPLE), */ /* sort_routing_set_handler); */ }
int secure_plugin_init(void) { int i; /* Initialize the timestamp database */ for(i = 0; i < HASHSIZE; i++) { timestamps[i].next = ×tamps[i]; timestamps[i].prev = ×tamps[i]; } olsr_printf(1, "Timestamp database initialized\n"); if(!strlen(keyfile)) strscpy(keyfile, KEYFILE, sizeof(keyfile)); i = read_key_from_file(keyfile); if(i < 0) { olsr_printf(1, "[ENC]Could not read key from file %s!\nExitting!\n\n", keyfile); exit(1); } if(i == 0) { olsr_printf(1, "[ENC]There was a problem reading key from file %s. Is the key long enough?\nExitting!\n\n", keyfile); exit(1); } /* Register the packet transform function */ add_ptf(&add_signature); olsr_preprocessor_add_function(&secure_preprocessor); /* Register timeout - poll every 2 seconds */ olsr_start_timer(2 * MSEC_PER_SEC, 0, OLSR_TIMER_PERIODIC, &timeout_timestamps, NULL, 0); return 1; }
/** OLSR entrypoint to initialise the plugin. @return - 0 on fail - 1 on success */ int olsrd_plugin_init(void) { bool retval = initPud(); if (retval) { olsr_printf(0, "%s\n", PUD_PLUGIN_NAME_LONG #ifdef GIT_SHA " (" GIT_SHA ")" #endif ); } return (retval ? 1 : 0); }
void BMF_handle_encapsulatingFd(int skfd, void *data, unsigned int flags __attribute__ ((unused))) { unsigned char rxBuffer[BMF_BUFFER_SIZE]; struct TBmfInterface* walker = data; struct sockaddr_in from; socklen_t fromLen = sizeof(from); int nBytes; int minimumLength; union olsr_ip_addr forwardedBy; /* An encapsulated packet was received */ nBytes = recvfrom( skfd, rxBuffer, BMF_BUFFER_SIZE, 0, (struct sockaddr*)&from, &fromLen); if (nBytes < 0) { BmfPError("recvfrom() error on \"%s\"", walker->ifName); return; } /* if (nBytes < 0) */ forwardedBy.v4 = from.sin_addr; /* Check if the number of received bytes is large enough for a minimal BMF * encapsulation packet, at least: * - the encapsulation header * - a minimum IP header inside the encapsulated packet */ minimumLength = ENCAP_HDR_LEN + sizeof(struct ip); if (nBytes < minimumLength) { struct ipaddr_str buf; olsr_printf( 1, "%s: received a too short encapsulation packet (%d bytes) from %s on \"%s\"\n", PLUGIN_NAME, nBytes, olsr_ip_to_string(&buf, &forwardedBy), walker->ifName); return; } /* Unfortunately, the recvfrom call does not return the destination * of the encapsulation packet (the destination may be either the * my unicast or my local broadcast address). Therefore we fill in 'NULL' * for the 'forwardedTo' parameter. */ BmfEncapsulationPacketReceived(walker, &forwardedBy, NULL, rxBuffer); }
void print_mpr_selection(olsr_bool mpr_selection) { switch (mpr_selection) { case OLSR_TRUE: { olsr_printf("TRUE "); break; } case OLSR_FALSE: { olsr_printf("FALSE"); break; } default: { } //olsr_error("no such MPR Selection"); } }
void print_interface(olsr_u8_t interfaceId) { switch (interfaceId) { case OLSR_TRUE: { olsr_printf("YES"); break; } case OLSR_FALSE: { olsr_printf("NO "); break; } default: { } //olsr_error("no such interface"); } }
/* ------------------------------------------------------------------------- * Function : DoBmf * Description: Wait (blocking) for IP packets, then call the handler for each * received packet * Input : none * Output : none * Return : none * Data Used : BmfInterfaces * ------------------------------------------------------------------------- */ void BMF_handle_captureFd(int skfd, void *data, unsigned int flags __attribute__ ((unused))) { unsigned char rxBuffer[BMF_BUFFER_SIZE]; struct TBmfInterface* walker = data; struct sockaddr_ll pktAddr; socklen_t addrLen = sizeof(pktAddr); int nBytes; unsigned char* ipPacket; /* Receive the captured Ethernet frame, leaving space for the BMF * encapsulation header */ ipPacket = GetIpPacket(rxBuffer); nBytes = recvfrom( skfd, ipPacket, BMF_BUFFER_SIZE - ENCAP_HDR_LEN, 0, (struct sockaddr*)&pktAddr, &addrLen); if (nBytes < 0) { BmfPError("recvfrom() error on \"%s\"", walker->ifName); return; } /* if (nBytes < 0) */ /* Check if the number of received bytes is large enough for an IP * packet which contains at least a minimum-size IP header. * Note: There is an apparent bug in the packet socket implementation in * combination with VLAN interfaces. On a VLAN interface, the value returned * by 'recvfrom' may (but need not) be 4 (bytes) larger than the value * returned on a non-VLAN interface, for the same ethernet frame. */ if (nBytes < (int)sizeof(struct ip)) { olsr_printf( 1, "%s: captured frame too short (%d bytes) on \"%s\"\n", PLUGIN_NAME, nBytes, walker->ifName); return; } if (pktAddr.sll_pkttype == PACKET_OUTGOING || pktAddr.sll_pkttype == PACKET_MULTICAST || pktAddr.sll_pkttype == PACKET_BROADCAST) { /* A multicast or broadcast packet was captured */ BmfPacketCaptured(walker, pktAddr.sll_pkttype, rxBuffer); } /* if (pktAddr.sll_pkttype == ...) */ }
void print_tlv_block(OLSR_LIST *tlv_block) { OLSR_LIST_ENTRY *tmp = NULL; BASE_TLV *data_base_tlv = NULL; tmp = tlv_block->head; while (tmp) { data_base_tlv = (BASE_TLV *)tmp->data; olsr_printf("tlv_type = %d, tlv_length = %d, index_start = %d, index_stop = %d, ", data_base_tlv->tlv_type, data_base_tlv->tlv_length, data_base_tlv->index_start, data_base_tlv->index_stop); if(data_base_tlv->value) { olsr_printf("value = %d\n", *data_base_tlv->value); } tmp = tmp->next; } }
static void print_address_list(struct olsrv2 *olsr, struct address_list *list) { struct olsrd_config *olsr_cnf = olsr->olsr_cnf; struct address_list *tmp; if (olsr_cnf->debug_level < 5) return; tmp = list; olsr_printf("\t ------------- ALL ADDR INFO -------------\n"); while (tmp) { char* paddr = olsr_niigata_ip_to_string(olsr, &tmp->ip_addr); olsr_printf("IP ADDRESS[%s]\n", paddr); free(paddr); olsr_printf("\tINDEX[%u]\n", tmp->index); tmp = tmp->next; } olsr_printf("\t __________________________________________\n"); return; }
static void print_tlv_infomations(struct olsrv2 *olsr, struct tlv_info *info) { struct olsrd_config* olsr_cnf = olsr->olsr_cnf; if (olsr_cnf->debug_level < 5) return; olsr_printf("\t-----------TLV INFOMATIONS-----------------\n"); olsr_printf("\tType[%u]\n", info->type); olsr_printf("\tUserBit[%u]\n", info->user_bit); olsr_printf("\tTLV PROT[%u]\n", info->tlv_prot); olsr_printf("\tNoValueBit[%u]\n", info->no_value_bit); olsr_printf("\tExtendedBit[%u]\n", info->extended_bit); olsr_printf("\tNoIndexBit[%u]\n", info->no_index_bit); olsr_printf("\tSingleIndexBIt[%u]\n", info->single_index_bit); olsr_printf("\tMultiValueBit[%u]\n", info->multi_value_bit); return; }
void print_link_status(olsr_u8_t link_status) { switch (link_status) { case SYMMETRIC: { olsr_printf("SYMMETRIC "); break; } case ASYMMETRIC: { olsr_printf("ASYMMETRIC"); break; } /* case HEARD: { olsr_printf("HEARD "); break; } */ case LOST: { olsr_printf("LOST "); break; } /* case UNSPEC: */ /* { */ /* olsr_printf("UNSPEC"); */ /* break; */ /* } */ default: { } //olsr_error("no such link status"); } }