Committer: Miika Komu <miika@xxxxxx> Date: Tue Feb 16 10:35:10 2010 +0200 Revision: 3642 Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: All functions in netdev.c have now hip_ prefix. Modified: M hipd/hidb.h M hipd/init.c M hipd/input.c M hipd/netdev.c M hipd/netdev.h M hipd/update.c M hipd/user.c === modified file 'hipd/hidb.h' --- hipd/hidb.h 2010-02-16 08:26:09 +0000 +++ hipd/hidb.h 2010-02-16 08:35:10 +0000 @@ -86,5 +86,4 @@ int hip_get_default_hit_msg(struct hip_common *msg); int hip_get_default_lsi(struct in_addr *lsi); - #endif /* _HIP_DB */ === modified file 'hipd/init.c' --- hipd/init.c 2010-02-11 17:21:17 +0000 +++ hipd/init.c 2010-02-16 08:35:10 +0000 @@ -677,8 +677,7 @@ #ifdef CONFIG_HIP_HI3 if (hip_use_i3) { -// hip_get_default_hit(&peer_hit); - hip_i3_init(/*&peer_hit*/); + hip_i3_init(); } #endif @@ -1041,7 +1040,7 @@ hip_delete_all_sp(); //empty - delete_all_addresses(); + hip_delete_all_addresses(); set_up_device(HIP_HIT_DEV, 0); === modified file 'hipd/input.c' --- hipd/input.c 2010-02-12 10:47:40 +0000 +++ hipd/input.c 2010-02-16 08:35:10 +0000 @@ -2254,14 +2254,14 @@ } /* We need our local IP address as a sockaddr because - * add_address_to_list() eats only sockaddr structures. */ + * hip_add_address_to_list() eats only sockaddr structures. */ memset(&ss_addr, 0, sizeof(struct sockaddr_storage)); addr = (struct sockaddr *) &ss_addr; addr->sa_family = AF_INET6; memcpy(hip_cast_sa_addr(addr), &entry->our_addr, hip_sa_addr_len(addr)); - add_address_to_list(addr, if_index, 0); + hip_add_address_to_list(addr, if_index, 0); //hip_hadb_insert_state(entry); === modified file 'hipd/netdev.c' --- hipd/netdev.c 2010-02-16 08:26:09 +0000 +++ hipd/netdev.c 2010-02-16 08:35:10 +0000 @@ -143,7 +143,7 @@ return hip_netdev_hash(ptr1) != hip_netdev_hash(ptr2); } -static int count_if_addresses(int ifindex) +static int hip_count_if_addresses(int ifindex) { struct netdev_address *na; hip_list_t *n, *t; @@ -165,7 +165,7 @@ * @return FA_ADD if the given address @c addr is allowed to be one of the * addresses of this host, FA_IGNORE otherwise. */ -static int filter_address(struct sockaddr *addr) +static int hip_filter_address(struct sockaddr *addr) { char s[INET6_ADDRSTRLEN]; const struct in6_addr *a_in6 = NULL; @@ -257,7 +257,7 @@ } } -static int exists_address_family_in_list(const struct in6_addr *addr) +static int hip_exists_address_family_in_list(const struct in6_addr *addr) { struct netdev_address *n; hip_list_t *tmp, *t; @@ -275,7 +275,7 @@ return 0; } -int exists_address_in_list(const struct sockaddr *addr, int ifindex) +int hip_exists_address_in_list(const struct sockaddr *addr, int ifindex) { struct netdev_address *n; hip_list_t *tmp, *t; @@ -329,24 +329,24 @@ * Adds an IPv6 address into ifindex2spi map. * * Adds an IPv6 address into ifindex2spi map if the address passes - * filter_address() test. + * hip_filter_address() test. * * @param a pointer to a socket address structure. * @param network device interface index. */ -void add_address_to_list(struct sockaddr *addr, int ifindex, int flags) +void hip_add_address_to_list(struct sockaddr *addr, int ifindex, int flags) { struct netdev_address *n; unsigned char tmp_secret[40]; int err_rand = 0; - if (exists_address_in_list(addr, ifindex)) { + if (hip_exists_address_in_list(addr, ifindex)) { return; } - /* filter_address() prints enough debug info of the address, no need to + /* hip_filter_address() prints enough debug info of the address, no need to * print address related debug info here. */ - if (filter_address(addr)) { + if (hip_filter_address(addr)) { HIP_DEBUG("Address passed the address filter test.\n"); } else { HIP_DEBUG("Address failed the address filter test.\n"); @@ -392,7 +392,7 @@ "%d addresses.\n", address_count); } -static void delete_address_from_list(struct sockaddr *addr, int ifindex) +static void hip_delete_address_from_list(struct sockaddr *addr, int ifindex) { struct netdev_address *n; hip_list_t *item, *tmp; @@ -443,7 +443,7 @@ } } -void delete_all_addresses(void) +void hip_delete_all_addresses(void) { struct netdev_address *n; hip_list_t *item, *tmp; @@ -579,7 +579,7 @@ if (!g_iface->ifa_addr) { continue; } - if (exists_address_in_list(g_iface->ifa_addr, if_index)) { + if (hip_exists_address_in_list(g_iface->ifa_addr, if_index)) { continue; } HIP_IFEL(!(if_index = if_nametoindex(g_iface->ifa_name)), @@ -589,7 +589,7 @@ continue; } - add_address_to_list(g_iface->ifa_addr, if_index, 0); + hip_add_address_to_list(g_iface->ifa_addr, if_index, 0); } out_err: @@ -738,7 +738,7 @@ /*this function returns the locator for the given HIT from opendht(lookup)*/ -static int opendht_get_endpointinfo(const char *node_hit, struct in6_addr *addr) +static int hip_dht_get_endpointinfo(const char *node_hit, struct in6_addr *addr) { int err = -1; #ifdef CONFIG_HIP_DHT @@ -849,7 +849,7 @@ memset(hit_str, 0, sizeof(hit_str)); hip_in6_ntop(&hit2, hit_str); _HIP_DEBUG("### HIT STRING ### %s\n", (const char *) hit_str); - err = opendht_get_endpointinfo((const char *) hit_str, addr); + err = hip_dht_get_endpointinfo((const char *) hit_str, addr); _HIP_DEBUG_IN6ADDR("### ADDR ###", addr); if (err) { HIP_DEBUG("Got IP for HIT from DHT err = \n", err); @@ -1236,7 +1236,7 @@ { int addr_exists = 0, interface_count = 0; - addr_exists = exists_address_in_list(addr, interface_index); + addr_exists = hip_exists_address_in_list(addr, interface_index); HIP_DEBUG("is_add = %d, exists = %d\n", is_add, addr_exists); if ((is_add && addr_exists) || (!is_add && !addr_exists)) { @@ -1246,12 +1246,12 @@ } if (is_add) { - add_address_to_list(addr, interface_index, 0); + hip_add_address_to_list(addr, interface_index, 0); } else { - delete_address_from_list(addr, interface_index); + hip_delete_address_from_list(addr, interface_index); } - interface_count = count_if_addresses(interface_index); + interface_count = hip_count_if_addresses(interface_index); HIP_DEBUG("%d addr(s) in ifindex %d\n", interface_count, interface_index); } @@ -1343,7 +1343,7 @@ /* Trying to add an existing address or deleting a non-existing * address */ - exists = exists_address_in_list(addr, ifa->ifa_index); + exists = hip_exists_address_in_list(addr, ifa->ifa_index); HIP_IFEL(((exists && is_add) || (!exists && !is_add)), -1, "Address change discarded (exists=%d, is_add=%d)", exists, is_add); @@ -1470,7 +1470,7 @@ goto out_err; } - HIP_IFEL(!exists_address_family_in_list(dst), -1, "No address of the same family\n"); + HIP_IFEL(!hip_exists_address_family_in_list(dst), -1, "No address of the same family\n"); if (ipv6_addr_is_teredo(dst)) { const struct netdev_address *na; === modified file 'hipd/netdev.h' --- hipd/netdev.h 2010-02-16 08:26:09 +0000 +++ hipd/netdev.h 2010-02-16 08:35:10 +0000 @@ -44,16 +44,16 @@ int hip_devaddr2ifindex(struct in6_addr *addr); int hip_netdev_init_addresses(struct rtnl_handle *nl); -void delete_all_addresses(void); +void hip_delete_all_addresses(void); int hip_netdev_event(const struct nlmsghdr *msg, int len, void *arg); int hip_add_iface_local_hit(const hip_hit_t *local_hit); int hip_add_iface_local_route(const hip_hit_t *local_hit); int hip_select_source_address(struct in6_addr *src, const struct in6_addr *dst); int hip_netdev_trigger_bex_msg(struct hip_common *msg); -void add_address_to_list(struct sockaddr *addr, int ifindex, int flags); +void hip_add_address_to_list(struct sockaddr *addr, int ifindex, int flags); int hip_netdev_white_list_add(char *device_name); -int exists_address_in_list(const struct sockaddr *addr, int ifindex); +int hip_exists_address_in_list(const struct sockaddr *addr, int ifindex); void hip_copy_peer_addrlist_changed(hip_ha_t *ha); === modified file 'hipd/update.c' --- hipd/update.c 2010-02-11 09:57:04 +0000 +++ hipd/update.c 2010-02-16 08:35:10 +0000 @@ -266,7 +266,7 @@ } /* Use previous hadb source address if it still exists */ - if (exists_address_in_list((const struct sockaddr *) &ss, -1) && + if (hip_exists_address_in_list((const struct sockaddr *) &ss, -1) && are_addresses_compatible(&ha->our_addr, dst_addr)) { HIP_DEBUG("Reusing hadb old source address\n"); ipv6_addr_copy(new_src_addr, &ha->our_addr); === modified file 'hipd/user.c' --- hipd/user.c 2010-02-11 09:57:04 +0000 +++ hipd/user.c 2010-02-16 08:35:10 +0000 @@ -9,7 +9,7 @@ * @author Kristian Slavov <kslavov_hiit.fi> * @author Bing Zhou <bingzhou_cc.hut.fi> * @author Tao Wan <twan_cc.hut.fi> - * @author Rene Hummen + * @author Rene Hummen * @note Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a>. */ @@ -878,7 +878,7 @@ IPV6_TO_IPV4_MAP(dst_ip, &sock_addr.sin_addr); sock_addr.sin_family = AF_INET; /* The server address is added with 0 interface index */ - add_address_to_list((struct sockaddr *) &sock_addr, + hip_add_address_to_list((struct sockaddr *) &sock_addr, 0, HIP_FLAG_CONTROL_TRAFFIC_ONLY); @@ -887,7 +887,7 @@ sock_addr6.sin6_family = AF_INET6; sock_addr6.sin6_addr = *dst_ip; /* The server address is added with 0 interface index */ - add_address_to_list((struct sockaddr *) &sock_addr6, + hip_add_address_to_list((struct sockaddr *) &sock_addr6, 0, HIP_FLAG_CONTROL_TRAFFIC_ONLY); }