#include "olsr_types.h"#include "defs.h"#include "olsr_cfg.h"#include "common/string.h"#include <limits.h>#include <arpa/inet.h>

Go to the source code of this file.
Data Structures | |
| struct | ipaddr_str |
| struct | ipprefix_str |
Functions | |
| static INLINE int | ip4cmp (const struct in_addr *a, const struct in_addr *b) |
| static INLINE int | ip6cmp (const struct in6_addr *a, const struct in6_addr *b) |
| static INLINE int | ipcmp (int ip_version, const union olsr_ip_addr *a, const union olsr_ip_addr *b) |
| static INLINE int | olsr_ipcmp (const union olsr_ip_addr *a, const union olsr_ip_addr *b) |
| static INLINE void | genipcopy (void *dst, const void *src) |
| int | ip_in_net (const union olsr_ip_addr *ipaddr, const struct olsr_ip_prefix *net, int ip_version) |
| int EXPORT() | prefix_to_netmask (uint8_t *, int, uint8_t) |
| static INLINE int | olsr_prefix_to_netmask (union olsr_ip_addr *adr, uint8_t prefixlen) |
| uint8_t EXPORT() | netmask_to_prefix (const uint8_t *, int) |
| static INLINE uint8_t | olsr_netmask_to_prefix (const union olsr_ip_addr *adr) |
| static INLINE uint8_t | olsr_netmask4_to_prefix (const uint32_t *a) |
| static INLINE uint8_t | olsr_netmask6_to_prefix (const struct in6_addr *a) |
| static INLINE const char * | ip4_to_string (struct ipaddr_str *const buf, const struct in_addr addr4) |
| static INLINE const char * | ip6_to_string (struct ipaddr_str *const buf, const struct in6_addr *const addr6) |
| static INLINE const char * | olsr_sockaddr_to_string (struct ipaddr_str *const buf, const union olsr_sockaddr *s) |
| static INLINE const char * | ip_to_string (int af, struct ipaddr_str *const buf, const union olsr_ip_addr *addr) |
| static INLINE const char * | olsr_ip_to_string (struct ipaddr_str *const buf, const union olsr_ip_addr *addr) |
| const char *EXPORT() | ip_prefix_to_string (int af, struct ipprefix_str *const buf, const struct olsr_ip_prefix *prefix) |
| static INLINE const char * | olsr_ip_prefix_to_string (struct ipprefix_str *const buf, const struct olsr_ip_prefix *prefix) |
| const char * | sockaddr_to_string (char *buf, int bufsize, const struct sockaddr *const addr, unsigned int addrsize) |
| static INLINE uint32_t | prefix_to_netmask4 (uint8_t prefixlen) |
| struct in6_addr | EXPORT (in6addr_v4mapped_loopback) |
| void EXPORT() | ip_map_4to6 (union olsr_ip_addr *ip) |
| static INLINE bool | is_prefix_niit_ipv6 (const struct olsr_ip_prefix *p) |
| static INLINE struct olsr_ip_prefix * | prefix_mappedv4_to_v4 (struct olsr_ip_prefix *v4, const struct olsr_ip_prefix *v6) |
| static INLINE bool | ip_is_linklocal (const union olsr_ip_addr *ip) |
| static INLINE bool | ip_prefix_is_mappedv4 (const struct olsr_ip_prefix *prefix) |
| static INLINE bool | ip_prefix_is_mappedv4_inetgw (const struct olsr_ip_prefix *prefix) |
| static INLINE bool | ip_prefix_is_v4_inetgw (const struct olsr_ip_prefix *prefix) |
| static INLINE bool | ip_prefix_is_v6_inetgw (const struct olsr_ip_prefix *prefix) |
| bool | is_prefix_inetgw (const struct olsr_ip_prefix *prefix) |
Variables | |
| union olsr_ip_addr | all_zero |
| struct olsr_ip_prefix | ipv4_internet_route |
| struct olsr_ip_prefix | ipv6_mappedv4_route |
| struct olsr_ip_prefix | ipv6_internet_route |
| struct in6_addr EXPORT | ( | in6addr_v4mapped_loopback | ) | [read] |
| static INLINE void genipcopy | ( | void * | dst, | |
| const void * | src | |||
| ) | [static] |
Definition at line 107 of file ipcalc.h.
References olsr_config::ipsize, and olsr_cnf.
| static INLINE const char* ip4_to_string | ( | struct ipaddr_str *const | buf, | |
| const struct in_addr | addr4 | |||
| ) | [static] |
Definition at line 143 of file ipcalc.h.
References ipaddr_str::buf, and inet_ntop().
Referenced by activate_tree_link(), addObampNode4(), chk_if_changed(), CoreElection(), deactivate_tree_link(), EncapFlowInObamp(), forward_obamp_data(), InitOBAMP(), manage_tree_create(), mesh_create(), os_init_interface(), PacketReceivedFromOLSR(), parse_cfg_interface(), printObampNodesList(), purge_nodes(), send_destroy_tree_link(), tree_create(), tree_link_ack(), tree_link_req(), and txtinfo_interfaces().

| static INLINE int ip4cmp | ( | const struct in_addr * | a, | |
| const struct in_addr * | b | |||
| ) | [static] |
Definition at line 80 of file ipcalc.h.
Referenced by avl_comp_ipv4(), avl_comp_ipv4_prefix(), chk_if_changed(), ipc_action(), ipcmp(), and mapwrite_work().
| static INLINE const char* ip6_to_string | ( | struct ipaddr_str *const | buf, | |
| const struct in6_addr *const | addr6 | |||
| ) | [static] |
Definition at line 149 of file ipcalc.h.
References AF_INET6, ipaddr_str::buf, and inet_ntop().
Referenced by chk_if_changed(), os_init_interface(), parse_cfg_interface(), and txtinfo_interfaces().

Definition at line 86 of file ipcalc.h.
Referenced by avl_comp_ipv6(), avl_comp_ipv6_addr_origin(), avl_comp_ipv6_prefix(), avl_comp_ipv6_prefix_origin(), chk_if_changed(), ipcmp(), and mapwrite_work().
| int ip_in_net | ( | const union olsr_ip_addr * | ipaddr, | |
| const struct olsr_ip_prefix * | net, | |||
| int | ip_version | |||
| ) |
Definition at line 179 of file ipcalc.c.
References ARM_NOWARN_ALIGN, olsr_ip_prefix::prefix, olsr_ip_prefix::prefix_len, prefix_to_netmask4(), in6_addr::s6_addr, olsr_ip_addr::v4, and olsr_ip_addr::v6.
Referenced by get_ipv6_address(), and ip_acl_acceptable().

| static INLINE bool ip_is_linklocal | ( | const union olsr_ip_addr * | ip | ) | [static] |
Definition at line 217 of file ipcalc.h.
References AF_INET6, olsr_config::ip_version, olsr_cnf, in6_addr::s6_addr, and olsr_ip_addr::v6.
| void EXPORT() ip_map_4to6 | ( | union olsr_ip_addr * | ip | ) |
Definition at line 85 of file ipcalc.c.
References in6_addr::s6_addr, olsr_ip_addr::v4, and olsr_ip_addr::v6.
Referenced by ip_acl_plugin_parse().
| static INLINE bool ip_prefix_is_mappedv4 | ( | const struct olsr_ip_prefix * | prefix | ) | [static] |
Definition at line 223 of file ipcalc.h.
References ipv6_mappedv4_route, and olsr_ip_prefix::prefix_len.
| static INLINE bool ip_prefix_is_mappedv4_inetgw | ( | const struct olsr_ip_prefix * | prefix | ) | [static] |
Definition at line 229 of file ipcalc.h.
References ipv6_mappedv4_route, and olsr_ip_prefix::prefix_len.
Referenced by is_prefix_inetgw(), and olsr_os_niit_6to4_route().
| static INLINE bool ip_prefix_is_v4_inetgw | ( | const struct olsr_ip_prefix * | prefix | ) | [static] |
Definition at line 235 of file ipcalc.h.
References ipv4_internet_route, olsr_ip_prefix::prefix, olsr_ip_prefix::prefix_len, and olsr_ip_addr::v4.
Referenced by is_prefix_inetgw(), and olsr_os_niit_4to6_route().
| static INLINE bool ip_prefix_is_v6_inetgw | ( | const struct olsr_ip_prefix * | prefix | ) | [static] |
Definition at line 241 of file ipcalc.h.
References ipv6_internet_route, and olsr_ip_prefix::prefix_len.
Referenced by is_prefix_inetgw().
| const char* EXPORT() ip_prefix_to_string | ( | int | af, | |
| struct ipprefix_str *const | buf, | |||
| const struct olsr_ip_prefix * | prefix | |||
| ) |
Definition at line 165 of file ipcalc.c.
References ipprefix_str::buf, inet_ntop(), olsr_ip_prefix::prefix, and olsr_ip_prefix::prefix_len.
Referenced by olsr_ip_prefix_to_string(), and olsr_write_cnf_buf().

| static INLINE const char* ip_to_string | ( | int | af, | |
| struct ipaddr_str *const | buf, | |||
| const union olsr_ip_addr * | addr | |||
| ) | [static] |
Definition at line 169 of file ipcalc.h.
References ipaddr_str::buf, and inet_ntop().
Referenced by olsr_ip_to_string(), parse_cfg_hna(), and parse_cfg_interface().

| static INLINE int ipcmp | ( | int | ip_version, | |
| const union olsr_ip_addr * | a, | |||
| const union olsr_ip_addr * | b | |||
| ) | [static] |
Definition at line 92 of file ipcalc.h.
References ip4cmp(), ip6cmp(), olsr_ip_addr::v4, and olsr_ip_addr::v6.
Referenced by ip_prefix_list_find(), ip_prefix_list_remove(), and olsr_ipcmp().

| bool is_prefix_inetgw | ( | const struct olsr_ip_prefix * | prefix | ) |
Definition at line 251 of file ipcalc.c.
References AF_INET6, ip_prefix_is_mappedv4_inetgw(), ip_prefix_is_v4_inetgw(), ip_prefix_is_v6_inetgw(), olsr_config::ip_version, and olsr_cnf.
Referenced by olsr_os_process_rt_entry().

| static INLINE bool is_prefix_niit_ipv6 | ( | const struct olsr_ip_prefix * | p | ) | [static] |
Definition at line 204 of file ipcalc.h.
References AF_INET6, olsr_config::ip_version, ipv6_mappedv4_route, olsr_cnf, olsr_ip_prefix::prefix, olsr_ip_prefix::prefix_len, and olsr_ip_addr::v6.
| uint8_t EXPORT() netmask_to_prefix | ( | const uint8_t * | , | |
| int | ||||
| ) |
Definition at line 112 of file ipcalc.c.
References olsr_ip_prefix::prefix.
Referenced by olsr_netmask4_to_prefix(), olsr_netmask6_to_prefix(), olsr_netmask_to_prefix(), parse_cfg_hna(), and pkt_get_prefixlen().
| static INLINE const char* olsr_ip_prefix_to_string | ( | struct ipprefix_str *const | buf, | |
| const struct olsr_ip_prefix * | prefix | |||
| ) | [static] |
Definition at line 183 of file ipcalc.h.
References ip_prefix_to_string(), olsr_config::ip_version, and olsr_cnf.
Referenced by allowed_ip(), build_config_body(), ipc_print_net(), olsr_expire_hna_net_entry(), olsr_new_netlink_route(), olsr_os_inetgw_tunnel_route(), olsr_os_niit_4to6_route(), olsr_os_niit_6to4_route(), olsr_print_hna_set(), olsr_print_routing_table(), olsr_rt_to_string(), olsr_rtp_to_string(), txtinfo_hna(), and txtinfo_routes().

| static INLINE const char* olsr_ip_to_string | ( | struct ipaddr_str *const | buf, | |
| const union olsr_ip_addr * | addr | |||
| ) | [static] |
Definition at line 175 of file ipcalc.h.
References ip_to_string(), olsr_config::ip_version, and olsr_cnf.
Referenced by add_interface(), add_link_entry(), add_lost_interface_ip(), allowed_hostname_or_ip_in_service(), allowed_ip(), arproaming_client_add(), arproaming_client_update(), BmfEncapsulationPacketReceived(), BmfPacketCaptured(), BmfTunPacketCaptured(), build_config_body(), build_ipaddr_link(), build_mid_body(), build_neigh_body(), check_gw(), chk_if_changed(), create_packet(), debuginfo_print_trafficip(), decap_namemsg(), DoBmf(), FindNeighbors(), hello_tap(), insert_new_name_in_list(), internal_delete_tc_edge_entry(), ipc_print_neigh_link(), ipc_print_net(), ipc_print_tc_link(), join_mcast(), lookup_link_entry(), lookup_timestamp_entry(), lq_etxff_packet_parser(), lq_etxff_timer(), main(), mapwrite_work(), olsr_add_invalid_address(), olsr_add_nbr2_entry(), olsr_add_nbr_entry(), olsr_add_tc_edge_entry(), olsr_add_tc_entry(), olsr_calculate_routing_table(), olsr_com_handle_htmlsite(), olsr_com_handle_txtcommand(), olsr_com_parse_connection(), olsr_com_parse_request(), olsr_delete_link_entry_by_if(), olsr_delete_nbr2_entry(), olsr_delete_nbr_entry(), olsr_delete_routing_table(), olsr_delete_tc_entry(), olsr_expire_hna_net_entry(), olsr_expire_mid_entries(), olsr_expire_tc_edge_gc(), olsr_expire_tc_entry(), olsr_fixup_mid_main_addr(), olsr_flush_hna_nets(), olsr_flush_nbr2_duplicates(), olsr_forward_message(), olsr_input(), olsr_input_hna(), olsr_input_mid(), olsr_input_tc(), olsr_insert_mid_entry(), olsr_insert_routing_table(), olsr_is_duplicate_message(), olsr_msg_statistics(), olsr_namesvc_delete_db_entry(), olsr_new_netlink_route(), olsr_os_process_rt_entry(), olsr_parser(), olsr_print_duplicate_table(), olsr_print_hna_set(), olsr_print_link_set(), olsr_print_mid_set(), olsr_print_neighbor_table(), olsr_print_routing_table(), olsr_print_tc_table(), olsr_rt_to_string(), olsr_rtp_to_string(), olsr_spf_add_cand_tree(), olsr_spf_add_path_list(), olsr_spf_del_cand_tree(), olsr_spf_relax(), olsr_tc_edge_to_string(), olsr_update_nbr_status(), olsr_validate_address(), parse_challenge(), parse_cres(), parse_http_request(), parse_packet(), parse_rres(), remove_lost_interface_ip(), remove_nonvalid_names_from_list(), secure_preprocessor(), select_best_nameserver(), send_challenge(), send_cres(), send_rres(), timeout_timestamps(), txtinfo_hna(), txtinfo_link(), txtinfo_mid(), txtinfo_neigh(), txtinfo_neigh2(), txtinfo_routes(), txtinfo_topology(), update_name_entry(), validate_packet(), write_hosts_file(), write_resolv_file(), and write_services_file().

| static INLINE int olsr_ipcmp | ( | const union olsr_ip_addr * | a, | |
| const union olsr_ip_addr * | b | |||
| ) | [static] |
Definition at line 98 of file ipcalc.h.
References olsr_config::ip_version, ipcmp(), and olsr_cnf.
Referenced by add_interface(), allowed_ip(), BmfPacketCaptured(), BmfTunPacketCaptured(), check_link_status(), check_neighbor_link(), debuginfo_print_trafficip(), decap_namemsg(), FindNeighbors(), generate_hello(), generate_mid(), hello_tap(), if_ifwithaddr(), insert_new_name_in_list(), lookup_link_entry(), lookup_mpr_status(), lookup_name_latlon(), lookup_position_latlon(), name_init(), olsr_add_tc_entry(), olsr_change_myself_tc(), olsr_cmp_rtp(), olsr_enqueue_rt(), olsr_nh_change(), olsr_os_process_rt_entry(), olsr_output_lq_tc_internal(), olsr_parser(), parse_packet(), set_loss_link_multiplier(), and txtinfo_mid().

| static INLINE uint8_t olsr_netmask4_to_prefix | ( | const uint32_t * | a | ) | [static] |
Definition at line 132 of file ipcalc.h.
References netmask_to_prefix().

| static INLINE uint8_t olsr_netmask6_to_prefix | ( | const struct in6_addr * | a | ) | [static] |
Definition at line 137 of file ipcalc.h.
References netmask_to_prefix().

| static INLINE uint8_t olsr_netmask_to_prefix | ( | const union olsr_ip_addr * | adr | ) | [static] |
Definition at line 126 of file ipcalc.h.
References olsr_config::ipsize, netmask_to_prefix(), olsr_cnf, in6_addr::s6_addr, and olsr_ip_addr::v6.
Referenced by check_for_route(), check_ping_result(), ip_acl_plugin_parse(), looped_checks(), olsr_event(), olsr_parser(), olsrd_plugin_init(), set_plugin_hna(), and yyparse().

| static INLINE int olsr_prefix_to_netmask | ( | union olsr_ip_addr * | adr, | |
| uint8_t | prefixlen | |||
| ) | [static] |
Definition at line 118 of file ipcalc.h.
References olsr_config::ipsize, olsr_cnf, prefix_to_netmask(), in6_addr::s6_addr, and olsr_ip_addr::v6.
Referenced by add_del_route(), add_del_route6(), allowed_ip(), check_gw(), generate_hna(), os_route_add_rtentry(), os_route_del_rtentry(), and yyparse().

| static INLINE const char* olsr_sockaddr_to_string | ( | struct ipaddr_str *const | buf, | |
| const union olsr_sockaddr * | s | |||
| ) | [static] |
Definition at line 155 of file ipcalc.h.
References AF_INET6, ipaddr_str::buf, inet_ntop(), sockaddr_in6::sin6_addr, olsr_sockaddr::storage, strscpy(), olsr_sockaddr::v4, and olsr_sockaddr::v6.
Referenced by build_config_body(), join_mcast(), mapwrite_work(), and net_output().

| static INLINE struct olsr_ip_prefix* prefix_mappedv4_to_v4 | ( | struct olsr_ip_prefix * | v4, | |
| const struct olsr_ip_prefix * | v6 | |||
| ) | [static, read] |
Definition at line 210 of file ipcalc.h.
References olsr_ip_prefix::prefix, olsr_ip_prefix::prefix_len, in6_addr::s6_addr, olsr_ip_addr::v4, and olsr_ip_addr::v6.
| int EXPORT() prefix_to_netmask | ( | uint8_t * | , | |
| int | , | |||
| uint8_t | ||||
| ) |
Definition at line 93 of file ipcalc.c.
References MIN.
Referenced by olsr_prefix_to_netmask(), and pkt_put_prefixlen().
| static INLINE uint32_t prefix_to_netmask4 | ( | uint8_t | prefixlen | ) | [static] |
Definition at line 194 of file ipcalc.h.
Referenced by ip_in_net().
| const char* sockaddr_to_string | ( | char * | buf, | |
| int | bufsize, | |||
| const struct sockaddr *const | addr, | |||
| unsigned int | addrsize | |||
| ) |
Definition at line 228 of file ipcalc.c.
References AF_INET6, MIN, sockaddr4_to_string(), and sockaddr6_to_string().
Referenced by olsr_input().

| union olsr_ip_addr all_zero |
Definition at line 60 of file ipcalc.c.
Referenced by add_interface(), arproaming_init(), olsr_add_tc_entry(), olsr_get_default_cfg(), olsr_sanity_check_cfg(), and set_loss_link_multiplier().
Definition at line 63 of file ipcalc.c.
Referenced by ip_prefix_is_v4_inetgw(), and olsr_os_inetgw_tunnel_route().
Definition at line 77 of file ipcalc.c.
Referenced by ip_prefix_is_v6_inetgw(), and olsr_os_inetgw_tunnel_route().
Definition at line 70 of file ipcalc.c.
Referenced by ip_prefix_is_mappedv4(), ip_prefix_is_mappedv4_inetgw(), and is_prefix_niit_ipv6().
1.6.3