#include "defs.h"#include "link_set.h"#include "mid_set.h"#include "neighbor_table.h"#include "olsr.h"#include "olsr_timer.h"#include "olsr_socket.h"#include "olsr_spf.h"#include "net_olsr.h"#include "ipcalc.h"#include "lq_plugin.h"#include "common/string.h"#include "olsr_logging.h"#include <assert.h>
Go to the source code of this file.
Functions | |
| static void | olsr_expire_link_entry (void *context) |
| static void | olsr_expire_link_loss_timer (void *context) |
| static void | olsr_expire_link_sym_timer (void *context) |
| void | signal_link_changes (bool val) |
| static int | check_link_status (const struct lq_hello_message *message, const struct interface *in_if) |
| static struct link_entry * | add_link_entry (const union olsr_ip_addr *, const union olsr_ip_addr *, union olsr_ip_addr *, uint32_t, uint32_t, struct interface *) |
| void | olsr_init_link_set (void) |
| int | lookup_link_status (const struct link_entry *entry) |
| struct link_entry * | get_best_link_to_neighbor_ip (const union olsr_ip_addr *remote) |
| struct link_entry * | get_best_link_to_neighbor (struct nbr_entry *nbr) |
| static void | set_loss_link_multiplier (struct link_entry *entry) |
| static void | olsr_delete_link_entry (struct link_entry *link) |
| void | olsr_delete_link_entry_by_if (const struct interface *ifp) |
| void | olsr_expire_link_hello_timer (void *context) |
| static void | olsr_set_link_timer (struct link_entry *link, unsigned int rel_timer) |
| int | check_neighbor_link (const union olsr_ip_addr *int_addr) |
| struct link_entry * | lookup_link_entry (const union olsr_ip_addr *remote, const union olsr_ip_addr *remote_main, const struct interface *local) |
| struct link_entry * | update_link_entry (const union olsr_ip_addr *local, const union olsr_ip_addr *remote, struct lq_hello_message *message, struct interface *in_if) |
| int | replace_neighbor_link_set (const struct nbr_entry *old, struct nbr_entry *new) |
| void | olsr_print_link_set (void) |
| void | olsr_update_packet_loss_hello_int (struct link_entry *entry, uint32_t loss_hello_int) |
| void | olsr_update_packet_loss (struct link_entry *entry) |
| void | generate_hello (void *p) |
Variables | |
| struct list_entity | link_entry_head |
| static struct olsr_timer_info * | link_dead_timer_info = NULL |
| static struct olsr_timer_info * | link_loss_timer_info = NULL |
| static struct olsr_timer_info * | link_sym_timer_info = NULL |
| bool | link_changes |
| static struct link_entry * add_link_entry | ( | const union olsr_ip_addr * | local, | |
| const union olsr_ip_addr * | remote, | |||
| union olsr_ip_addr * | remote_main, | |||
| uint32_t | vtime, | |||
| uint32_t | htime, | |||
| struct interface * | local_if | |||
| ) | [static, read] |
Nothing mysterious here. Adding a new link entry to the link set.
| local | the local IP address | |
| remote | the remote IP address | |
| remote_main | the remote nodes main address | |
| vtime | the validity time of the entry | |
| htime | the HELLO interval of the remote node | |
| local_if | the local interface |
Definition at line 364 of file link_set.c.
References ASYM_LINK, changes_neighborhood, interface::int_name, olsr_config::ipsize, LINK_COST_BROKEN, link_entry_head, nbr_entry::linkcount, list_add_before(), lock_interface(), LOG_LINKS, lookup_link_entry(), olsr_add_nbr_entry(), olsr_cnf, OLSR_DEBUG, olsr_insert_routing_table(), olsr_ip_to_string(), OLSR_LINK_LOSS_JITTER, olsr_lookup_nbr_entry(), olsr_malloc_link_entry(), OLSR_RT_ORIGIN_LINK, olsr_set_link_timer(), olsr_timer_set(), set_loss_link_multiplier(), and nbr_entry::tc_edge.
Referenced by update_link_entry().

| static int check_link_status | ( | const struct lq_hello_message * | message, | |
| const struct interface * | in_if | |||
| ) | [static] |
Checks the link status to a neighbor by looking in a received HELLO message.
| message | the HELLO message to check |
Definition at line 604 of file link_set.c.
References lq_hello_neighbor::addr, interface::ip_addr, lq_hello_neighbor::link_type, lq_hello_message::neigh, lq_hello_neighbor::next, olsr_ipcmp(), SYM_LINK, and UNSPEC_LINK.
Referenced by update_link_entry().

| int check_neighbor_link | ( | const union olsr_ip_addr * | int_addr | ) |
Lookup the status of a link.
| int_addr | address of the remote interface |
Definition at line 463 of file link_set.c.
References lookup_link_status(), link_entry::neighbor_iface_addr, OLSR_FOR_ALL_LINK_ENTRIES, olsr_ipcmp(), and UNSPEC_LINK.
Referenced by olsr_input_hna(), olsr_input_mid(), olsr_input_tc(), and olsr_parser().

| void generate_hello | ( | void * | p | ) |
Definition at line 731 of file link_set.c.
References __attribute__(), COUNT_LINK_TYPES, COUNT_NEIGH_TYPES, CREATE_LINK_CODE, get_msg_seqno(), interface::hello_interval, interface::hello_validity, olsr_message::hopcnt, link_entry::iflocal_link_status, link_entry::iflocal_neigh_status, interface::int_name, interface::ip_addr, olsr_config::ipsize, nbr_entry::is_mpr, nbr_entry::is_sym, link_entry::local_iface_addr, LOG_PACKET_CREATION, lookup_link_status(), MAXMESSAGESIZE, MPR_NEIGH, link_entry::neighbor, link_entry::neighbor_iface_addr, net_outbuffer_bytes_left(), net_outbuffer_push(), net_output(), NOT_NEIGH, olsr_cnf, OLSR_FOR_ALL_LINK_ENTRIES, olsr_get_Hello_MessageId(), OLSR_HEADERSIZE, OLSR_INFO, olsr_ipcmp(), olsr_put_msg_hdr(), olsr_serialize_hello_lq_pair(), olsr_message::originator, pkt_put_ipaddress(), pkt_put_reltime(), pkt_put_u16(), pkt_put_u8(), olsr_config::router_id, olsr_message::seqno, olsr_message::size, SYM_NEIGH, olsr_message::ttl, olsr_message::type, UNSPEC_LINK, olsr_message::vtime, and olsr_config::willingness.
Referenced by init_interfaces().

| struct link_entry* get_best_link_to_neighbor | ( | struct nbr_entry * | nbr | ) | [read] |
Find best link to a neighbor
Definition at line 143 of file link_set.c.
References LINK_COST_BROKEN, link_entry::linkcost, lookup_link_status(), link_entry::neighbor, OLSR_FOR_ALL_LINK_ENTRIES, and SYM_LINK.
Referenced by get_best_link_to_neighbor_ip(), olsr_calculate_lq_mpr2(), olsr_calculate_routing_table(), olsr_neighbor_cost_may_changed(), olsr_update_nbr_status(), process_message_neighbors(), and txtinfo_neigh2().

| struct link_entry* get_best_link_to_neighbor_ip | ( | const union olsr_ip_addr * | remote | ) | [read] |
Find best link to a neighbor
Definition at line 131 of file link_set.c.
References get_best_link_to_neighbor(), and olsr_lookup_nbr_entry().
Referenced by BmfPacketCaptured(), FindNeighbors(), ipc_print_neigh_link(), olsr_output_lq_tc_internal(), and olsr_print_neighbor_table().

| struct link_entry* lookup_link_entry | ( | const union olsr_ip_addr * | remote, | |
| const union olsr_ip_addr * | remote_main, | |||
| const struct interface * | local | |||
| ) | [read] |
Lookup a link entry
| remote | the remote interface address | |
| remote_main | the remote nodes main address | |
| local | the local interface address |
Definition at line 485 of file link_set.c.
References link_entry::if_name, interface::int_name, interface::ip_addr, link_entry::local_iface_addr, LOG_LINKS, nbr_entry::nbr_addr, link_entry::neighbor, link_entry::neighbor_iface_addr, OLSR_DEBUG, OLSR_FOR_ALL_LINK_ENTRIES, olsr_ip_to_string(), and olsr_ipcmp().
Referenced by add_link_entry(), and lq_etxff_packet_parser().

| int lookup_link_status | ( | const struct link_entry * | entry | ) |
Get the status of a link. The status is based upon different timeouts in the link entry.
| remote | address of the remote interface |
Definition at line 110 of file link_set.c.
References ASYM_LINK, link_entry::ASYM_time, link_entry_head, link_entry::link_sym_timer, list_is_empty(), LOST_LINK, olsr_clock_isPast(), SYM_LINK, and UNSPEC_LINK.
Referenced by check_neighbor_link(), generate_hello(), get_best_link_to_neighbor(), olsr_expire_link_sym_timer(), and olsr_update_nbr_status().

| static void olsr_delete_link_entry | ( | struct link_entry * | link | ) | [static] |
Definition at line 215 of file link_set.c.
References changes_neighborhood, link_entry::if_name, link_entry::inter, olsr_config::ipsize, link_entry::is_mprs, link_entry::link_list, link_entry::link_loss_timer, link_entry::link_sym_timer, link_entry::link_timer, nbr_entry::linkcount, list_remove(), nbr_entry::mprs_count, nbr_entry::nbr_addr, link_entry::neighbor, link_entry::neighbor_iface_addr, olsr_cnf, olsr_delete_nbr_entry(), olsr_delete_routing_table(), olsr_free_link_entry(), OLSR_RT_ORIGIN_LINK, olsr_timer_stop(), and unlock_interface().
Referenced by olsr_delete_link_entry_by_if(), and olsr_expire_link_entry().

| void olsr_delete_link_entry_by_if | ( | const struct interface * | ifp | ) |
Delete all link entries matching a given interface id
Definition at line 260 of file link_set.c.
References interface::int_name, link_entry::inter, LOG_LINKS, link_entry::neighbor_iface_addr, OLSR_DEBUG, olsr_delete_link_entry(), OLSR_FOR_ALL_LINK_ENTRIES, and olsr_ip_to_string().
Referenced by remove_interface().

| static void olsr_expire_link_entry | ( | void * | context | ) | [static] |
Callback for the link timer.
Definition at line 331 of file link_set.c.
References link_entry::link_timer, and olsr_delete_link_entry().
Referenced by olsr_init_link_set().

| void olsr_expire_link_hello_timer | ( | void * | context | ) |
Callback for the link_hello timer.
Definition at line 317 of file link_set.c.
References link_entry::neighbor, and olsr_update_nbr_status().

| static void olsr_expire_link_loss_timer | ( | void * | context | ) | [static] |
Callback for the link loss timer.
Definition at line 280 of file link_set.c.
References link_entry::link_loss_timer, link_entry::loss_helloint, OLSR_LINK_LOSS_JITTER, olsr_lq_hello_handler(), and olsr_timer_change().
Referenced by olsr_init_link_set().

| static void olsr_expire_link_sym_timer | ( | void * | context | ) | [static] |
Callback for the link SYM timer.
Definition at line 297 of file link_set.c.
References changes_neighborhood, link_entry::link_sym_timer, lookup_link_status(), link_entry::neighbor, olsr_update_nbr_status(), link_entry::status, and SYM_LINK.
Referenced by olsr_init_link_set().

| void olsr_init_link_set | ( | void | ) |
Definition at line 88 of file link_set.c.
References link_entry_head, list_init_head(), LOG_LINKS, olsr_expire_link_entry(), olsr_expire_link_loss_timer(), olsr_expire_link_sym_timer(), OLSR_INFO, and olsr_timer_add().
Referenced by main().

| void olsr_print_link_set | ( | void | ) |
Definition at line 630 of file link_set.c.
References olsr_config::ip_version, link_entry::linkcost, LOG_LINKS, LQTEXT_MAXLENGTH, link_entry::neighbor_iface_addr, olsr_clock_getWallclockString(), olsr_cnf, OLSR_FOR_ALL_LINK_ENTRIES, olsr_get_linkcost_text(), olsr_get_linkdata_text(), olsr_get_linklabel(), olsr_get_linklabel_count(), olsr_get_linklabel_maxlength(), OLSR_INFO, OLSR_INFO_NH, and olsr_ip_to_string().
Referenced by olsr_process_changes().

| static void olsr_set_link_timer | ( | struct link_entry * | link, | |
| unsigned int | rel_timer | |||
| ) | [static] |
Set the link expiration timer.
Definition at line 345 of file link_set.c.
References link_entry::link_timer, OLSR_LINK_JITTER, and olsr_timer_set().
Referenced by add_link_entry(), and update_link_entry().

| void olsr_update_packet_loss | ( | struct link_entry * | entry | ) |
Definition at line 721 of file link_set.c.
References link_entry::link_loss_timer, link_entry::loss_helloint, OLSR_LINK_LOSS_JITTER, olsr_lq_hello_handler(), and olsr_timer_set().
Referenced by hello_tap().

| void olsr_update_packet_loss_hello_int | ( | struct link_entry * | entry, | |
| uint32_t | loss_hello_int | |||
| ) |
Definition at line 715 of file link_set.c.
References link_entry::loss_helloint.
Referenced by hello_tap().
Function that updates all registered pointers to one neighbor entry with another pointer Used by MID updates.
the pointer to replace the pointer to use instead of "old"
Definition at line 575 of file link_set.c.
References link_entry_head, list_is_empty(), link_entry::neighbor, and OLSR_FOR_ALL_LINK_ENTRIES.
Referenced by olsr_fixup_mid_main_addr(), and olsr_flush_nbr2_duplicates().

| static void set_loss_link_multiplier | ( | struct link_entry * | entry | ) | [static] |
Definition at line 174 of file link_set.c.
References olsr_lq_mult::addr, all_zero, olsr_if_config::cnf, olsr_config::if_configs, if_ifwithaddr(), olsr_if_config::interf, LINK_LOSS_MULTIPLIER, link_entry::local_iface_addr, link_entry::loss_link_multiplier, olsr_if_options::lq_mult, link_entry::neighbor_iface_addr, olsr_lq_mult::next, olsr_if_config::next, olsr_cnf, olsr_ipcmp(), and olsr_lq_mult::value.
Referenced by add_link_entry().

| void signal_link_changes | ( | bool | val | ) |
Definition at line 76 of file link_set.c.
References link_changes.
Referenced by olsr_calculate_lq_mpr(), olsr_neighbor_cost_may_changed(), and olsr_update_nbr_status().
| struct link_entry* update_link_entry | ( | const union olsr_ip_addr * | local, | |
| const union olsr_ip_addr * | remote, | |||
| struct lq_hello_message * | message, | |||
| struct interface * | in_if | |||
| ) | [read] |
Update a link entry. This is the "main entrypoint" in the link-sensing. This function is called from the HELLO parser function. It makes sure a entry is updated or created.
| local | the local IP address | |
| remote | the remote IP address | |
| message | the HELLO message | |
| in_if | the interface on which this HELLO was received |
Definition at line 521 of file link_set.c.
References add_link_entry(), ASYM_LINK, link_entry::ASYM_time, check_link_status(), lq_hello_message::comm, lq_hello_message::htime, link_entry::link_sym_timer, link_entry::link_timer, LOST_LINK, NEIGHB_HOLD_TIME, link_entry::neighbor, olsr_clock_getAbsolute(), olsr_clock_getRelative(), OLSR_LINK_SYM_JITTER, olsr_set_link_timer(), olsr_timer_set(), olsr_timer_stop(), olsr_update_nbr_status(), olsr_message::originator, link_entry::status, SYM_LINK, olsr_timer_entry::timer_clock, link_entry::vtime, and olsr_message::vtime.
Referenced by hello_tap().

| bool link_changes |
Definition at line 73 of file link_set.c.
Referenced by main(), and signal_link_changes().
struct olsr_timer_info* link_dead_timer_info = NULL [static] |
Definition at line 69 of file link_set.c.
| struct list_entity link_entry_head |
Definition at line 67 of file link_set.c.
Referenced by add_link_entry(), lookup_link_status(), olsr_init_link_set(), and replace_neighbor_link_set().
struct olsr_timer_info* link_loss_timer_info = NULL [static] |
Definition at line 70 of file link_set.c.
struct olsr_timer_info* link_sym_timer_info = NULL [static] |
Definition at line 71 of file link_set.c.
1.6.3