SixXS::Sunset 2017-06-06

heartbeatd core on freebsd 5.2.1
[de] Shadow Hawkins on Tuesday, 27 July 2004 00:58:22
Hello, my heartbeatd gets every time my dsl is reconnected a core. I had a look to the core file and figured out, that the core is happend in freeaddrinfo which is ok if a NULL is give by parameter. And the parameter is NULL so the behavior is ok. But why is this happend? First where is this happend in client/hb.c in area around line 169. I had alook to getaddrinfo libc function and i don't understand why this could return res equal NULL but it happens so we could fix it with a if which abort the function like: if (!ressave) { hblog(LOG_ERR, "Couldn't resolve POP ip %s (ressave)\n", sIPv4POP); return -1; } freeaddrinfo(ressave); this. But is this really a solution? Why could ressave be NULL at this point? regards meno
[PATCH] heartbeatd core on freebsd 5.2.1
[de] Shadow Hawkins on Tuesday, 27 July 2004 07:42:52
Hey, sometimes it is good to sleep a night 8-) Now I found the problem with the possible core. The if with the getaddrinfo is only checking of < 0 that is wrong. getaddrinfo give a error if the return value is != 0 so please change the < 0 to != in getaddrinfo in this block than the problem will hopefully fixed. There is also another getaddrinfo which checks on < 0 so please change this also. regards P.S. the patch *** client/hb.c.orig Tue Jul 27 07:30:14 2004 --- client/hb.c Tue Jul 27 07:30:38 2004 *************** *** 91,97 **** hints.ai_socktype = SOCK_DGRAM; // Get the POP IPv4 into a sockaddr ! if (getaddrinfo(sIPv4POP, PORT, &hints, &res) < 0) { hblog(LOG_ERR, "Couldn't resolve POP ip %s\n", sIPv4POP); close(sockfd); --- 91,97 ---- hints.ai_socktype = SOCK_DGRAM; // Get the POP IPv4 into a sockaddr ! if (getaddrinfo(sIPv4POP, PORT, &hints, &res) != 0) { hblog(LOG_ERR, "Couldn't resolve POP ip %s\n", sIPv4POP); close(sockfd); *************** *** 147,153 **** hints.ai_socktype = SOCK_DGRAM; // Get the POP IPv4 into a sockaddr ! if (getaddrinfo(sIPv4LocalResolve, NULL, &hints, &res) < 0) { hblog(LOG_ERR, "Couldn't resolve POP ip %s\n", sIPv4POP); // We return a -1, thus the app will keep beating --- 147,153 ---- hints.ai_socktype = SOCK_DGRAM; // Get the POP IPv4 into a sockaddr ! if (getaddrinfo(sIPv4LocalResolve, NULL, &hints, &res) != 0) { hblog(LOG_ERR, "Couldn't resolve POP ip %s\n", sIPv4POP); // We return a -1, thus the app will keep beating
[PATCH] heartbeatd core on freebsd 5.2.1
[ch] Jeroen Massar SixXS Staff on Tuesday, 27 July 2004 09:39:37
This is a known issue which we didn't made a new version for because of the tomorrow being released AICCU tool. The reason why this bug crept in there is because of the assumption that getaddrinfo() like any other unix function returns a negative error value, apparently this is one of the very few functions that does return positive errors. This btw affects only FreeBSD, all other OS's return negative numbers.
[PATCH] heartbeatd core on freebsd 5.2.1
[fr] Carmen Sandiego on Monday, 02 August 2004 11:21:53
Thanks for this patch, I had the same problem in FreeBSD 4.8 and i didn't find a solution after examining the source code. Thanks.

Please note Posting is only allowed when you are logged in.

Static Sunset Edition of SixXS
©2001-2017 SixXS - IPv6 Deployment & Tunnel Broker