Hi Alex, Thanks for your comment. I have incorporated the changes and floated the patch as version 2. Thanks, Meenakshi High Availability Solutions Pvt. Ltd. www.hasolutions.in --------- Original Message --------- Subject: Re: [PATCH 1/1] plmcd: replace inet_aton with inet_pton [#207] From: "Jones, Alex" <ajo...@rbbn.com> Date: 9/28/18 5:59 pm To: "Meenakshi TK" <meenak...@hasolutions.in>, "mathi.np....@gmail.com" <mathi.np....@gmail.com> Cc: "opensaf-devel@lists.sourceforge.net" <opensaf-devel@lists.sourceforge.net>
Hi Meenakshi, Two minor comments: + Let's remove the (void *) casts. They are not necessary. + Also just delete the unneeded line (and your comment about "not sure why this is here. I will remove it".) No sense in having dead code. Alex From: Meenakshi TK <meenak...@hasolutions.in> Sent: Thursday, September 27, 2018 5:48:46 AM To: Jones, Alex; mathi.np....@gmail.com Cc: opensaf-devel@lists.sourceforge.net; Meenakshi TK Subject: [PATCH 1/1] plmcd: replace inet_aton with inet_pton [#207] NOTICE: This email was received from an EXTERNAL sender --- src/plm/plmcd/plmc_lib_internal.c | 4 ++-- src/plm/plmcd/plmcd.c | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plm/plmcd/plmc_lib_internal.c b/src/plm/plmcd/plmc_lib_internal.c index 83a845d..a4cc44a 100644 --- a/src/plm/plmcd/plmc_lib_internal.c +++ b/src/plm/plmcd/plmc_lib_internal.c @@ -734,7 +734,7 @@ void *plmc_udp_listener(void *arguments) NULL, PLMC_NOOP_CMD); pthread_exit((void *)NULL); } - inet_aton(match_ip, &inp); + inet_pton(AF_INET, match_ip, (void *)&inp); bzero(&servaddr, sizeof(servaddr)); servaddr.sin_family = AF_INET; @@ -1012,7 +1012,7 @@ void *plmc_tcp_listener(void *arguments) NULL, PLMC_NOOP_CMD); pthread_exit((void *)NULL); } - inet_aton(match_ip, &inp); + inet_pton(AF_INET, match_ip, (void *)&inp); servaddr.sin_family = AF_INET; servaddr.sin_port = htons(atoi(config.tcp_plms_listening_port)); diff --git a/src/plm/plmcd/plmcd.c b/src/plm/plmcd/plmcd.c index 767b9f2..6ccc44f 100644 --- a/src/plm/plmcd/plmcd.c +++ b/src/plm/plmcd/plmcd.c @@ -565,7 +565,8 @@ static int plmc_send_udp_msg(char *msg) /* server address */ memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; - if (!(inet_aton(config.controller_1_ip, &sin.sin_addr))) { + if (!(inet_pton(AF_INET,config.controller_1_ip, + (void *)&sin.sin_addr))) { syslog(LOG_ERR, "Invalid Controller 1 Address: %s", config.controller_1_ip); return -2; @@ -581,8 +582,10 @@ static int plmc_send_udp_msg(char *msg) (struct sockaddr *)&sin, sizeof(sin)); /* Now send same UDP datagram to controller_2_ip. */ - sin.sin_addr.s_addr = inet_addr(config.controller_2_ip); - if (!(inet_aton(config.controller_2_ip, &sin.sin_addr))) { + /* Not sure why the below line was there. I will remove it */ + //sin.sin_addr.s_addr = inet_addr(config.controller_2_ip); + if (!(inet_pton(AF_INET,config.controller_2_ip, + (void *)&sin.sin_addr))) { syslog(LOG_ERR, "Invalid Controller 2 Address: %s", config.controller_2_ip); return -2; @@ -913,8 +916,8 @@ int main(int argc, char **argv) if (controller % 2) { syslog(LOG_INFO, "Attempting to connect to controller 1"); - if (!(inet_aton(config.controller_1_ip, - &sin.sin_addr))) { + if (!(inet_pton(AF_INET, config.controller_1_ip, + (void *)&sin.sin_addr))) { syslog(LOG_ERR, "Invalid Controller 1 Address: %s", config.controller_1_ip); @@ -923,8 +926,8 @@ int main(int argc, char **argv) } else { syslog(LOG_INFO, "Attempting to connect to controller 2"); - if (!(inet_aton(config.controller_2_ip, - &sin.sin_addr))) { + if (!(inet_pton(AF_INET, config.controller_2_ip, + (void *)&sin.sin_addr))) { syslog(LOG_ERR, "Invalid Controller 2 Address: %s", config.controller_2_ip); -- 2.7.4 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel