Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 930517 Details for
Bug 1108522
Various small fixes for RHEL 7.1 (corosync rebase)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
totemconfig: refactor nodelist_to_interface func
tmp.BsoIydxcHE (text/plain), 5.40 KB, created by
Jan Friesse
on 2014-08-25 14:36:39 UTC
(
hide
)
Description:
totemconfig: refactor nodelist_to_interface func
Filename:
MIME Type:
Creator:
Jan Friesse
Created:
2014-08-25 14:36:39 UTC
Size:
5.40 KB
patch
obsolete
>From 63bf09776fb84e939cd56ec2c2d1bbea97c2e0e1 Mon Sep 17 00:00:00 2001 >From: Jan Friesse <jfriesse@redhat.com> >Date: Tue, 22 Jul 2014 11:46:51 +0200 >Subject: [PATCH] totemconfig: refactor nodelist_to_interface func > >Move finding of bindaddr in nodelist to generally usable function >totem_config_find_local_addr_in_nodelist and refactor >config_convert_nodelist_to_interface function to use it. > >Signed-off-by: Jan Friesse <jfriesse@redhat.com> >Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com> >--- > exec/totemconfig.c | 99 +++++++++++++++++++++++++++++++++++++++------------ > exec/totemconfig.h | 6 +++- > 2 files changed, 80 insertions(+), 25 deletions(-) > >diff --git a/exec/totemconfig.c b/exec/totemconfig.c >index 7046349..1d2e4c1 100644 >--- a/exec/totemconfig.c >+++ b/exec/totemconfig.c >@@ -571,29 +571,41 @@ static void put_nodelist_members_to_config(struct totem_config *totem_config) > icmap_iter_finalize(iter); > } > >-static void config_convert_nodelist_to_interface(struct totem_config *totem_config) >+/* >+ * Tries to find node (node_pos) in config nodelist which address matches any >+ * local interface. Address can be stored in ring0_addr or if ipaddr_key_prefix is not NULL >+ * key with prefix ipaddr_key is used (there can be multiuple of them) >+ * This function differs * from find_local_node_in_nodelist because it doesn't need bindnetaddr, >+ * but doesn't work when bind addr is network address (so IP must be exact >+ * match). >+ * >+ * Returns 1 on success (address was found, node_pos is then correctly set) or 0 on failure. >+ */ >+int totem_config_find_local_addr_in_nodelist(const char *ipaddr_key_prefix, unsigned int *node_pos) > { >- icmap_iter_t iter; >- const char *iter_key; >- int res = 0; >- unsigned int node_pos; >- char tmp_key[ICMAP_KEYNAME_MAXLEN]; >- char tmp_key2[ICMAP_KEYNAME_MAXLEN]; >- char *node_addr_str; >- unsigned int ringnumber = 0; > struct list_head addrs; >- struct list_head *list; > struct totem_ip_if_address *if_addr; >+ icmap_iter_t iter, iter2; >+ const char *iter_key, *iter_key2; >+ struct list_head *list; >+ const char *ipaddr_key; >+ int ip_version; > struct totem_ip_address node_addr; >+ char *node_addr_str; > int node_found = 0; >+ int res = 0; >+ char tmp_key[ICMAP_KEYNAME_MAXLEN]; > > if (totemip_getifaddrs(&addrs) == -1) { >- return ; >+ return 0; > } > >+ ip_version = totem_config_get_ip_version(); >+ > iter = icmap_iter_init("nodelist.node."); >+ > while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) { >- res = sscanf(iter_key, "nodelist.node.%u.%s", &node_pos, tmp_key); >+ res = sscanf(iter_key, "nodelist.node.%u.%s", node_pos, tmp_key); > if (res != 2) { > continue; > } >@@ -606,25 +618,50 @@ static void config_convert_nodelist_to_interface(struct totem_config *totem_conf > continue ; > } > >- if (totemip_parse(&node_addr, node_addr_str, totem_config->ip_version) == -1) { >- free(node_addr_str); >- continue ; >- } > free(node_addr_str); > > /* >- * Try to find node in if_addrs >+ * ring0_addr found -> let's iterate thru ipaddr_key_prefix > */ >- node_found = 0; >- for (list = addrs.next; list != &addrs; list = list->next) { >- if_addr = list_entry(list, struct totem_ip_if_address, list); >+ snprintf(tmp_key, sizeof(tmp_key), "nodelist.node.%u.%s", *node_pos, >+ (ipaddr_key_prefix != NULL ? ipaddr_key_prefix : "ring0_addr")); >+ >+ iter2 = icmap_iter_init(tmp_key); >+ while ((iter_key2 = icmap_iter_next(iter2, NULL, NULL)) != NULL) { >+ /* >+ * ring0_addr must be exact match, not prefix >+ */ >+ ipaddr_key = (ipaddr_key_prefix != NULL ? iter_key2 : tmp_key); >+ if (icmap_get_string(ipaddr_key, &node_addr_str) != CS_OK) { >+ continue ; >+ } > >- if (totemip_equal(&node_addr, &if_addr->ip_addr)) { >- node_found = 1; >- break; >+ if (totemip_parse(&node_addr, node_addr_str, ip_version) == -1) { >+ free(node_addr_str); >+ continue ; >+ } >+ free(node_addr_str); >+ >+ /* >+ * Try to match ip with if_addrs >+ */ >+ node_found = 0; >+ for (list = addrs.next; list != &addrs; list = list->next) { >+ if_addr = list_entry(list, struct totem_ip_if_address, list); >+ >+ if (totemip_equal(&node_addr, &if_addr->ip_addr)) { >+ node_found = 1; >+ break; >+ } >+ } >+ >+ if (node_found) { >+ break ; > } > } > >+ icmap_iter_finalize(iter2); >+ > if (node_found) { > break ; > } >@@ -633,7 +670,21 @@ static void config_convert_nodelist_to_interface(struct totem_config *totem_conf > icmap_iter_finalize(iter); > totemip_freeifaddrs(&addrs); > >- if (node_found) { >+ return (node_found); >+} >+ >+static void config_convert_nodelist_to_interface(struct totem_config *totem_config) >+{ >+ int res = 0; >+ unsigned int node_pos; >+ char tmp_key[ICMAP_KEYNAME_MAXLEN]; >+ char tmp_key2[ICMAP_KEYNAME_MAXLEN]; >+ char *node_addr_str; >+ unsigned int ringnumber = 0; >+ icmap_iter_t iter; >+ const char *iter_key; >+ >+ if (totem_config_find_local_addr_in_nodelist(NULL, &node_pos)) { > /* > * We found node, so create interface section > */ >diff --git a/exec/totemconfig.h b/exec/totemconfig.h >index d003f3f..10607cc 100644 >--- a/exec/totemconfig.h >+++ b/exec/totemconfig.h >@@ -56,8 +56,12 @@ extern int totem_config_validate ( > struct totem_config *totem_config, > const char **error_string); > >-int totem_config_keyread ( >+extern int totem_config_keyread ( > struct totem_config *totem_config, > const char **error_string); > >+extern int totem_config_find_local_addr_in_nodelist( >+ const char *ipaddr_key_prefix, >+ unsigned int *node_pos); >+ > #endif /* TOTEMCONFIG_H_DEFINED */ >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1108522
:
907995
|
907996
|
907997
|
907998
|
907999
|
908004
|
908111
|
930505
|
930506
|
930507
|
930509
|
930510
|
930511
|
930512
|
930513
|
930514
|
930515
|
930516
| 930517 |
930518
|
930519
|
930527
|
930528
|
930529
|
930530
|
930531
|
930535
|
930536
|
930537
|
930538
|
930539
|
930540
|
931024