IPv6 and FreeBSD
Julien ÉLIE
julien at trigofacile.com
Sat Oct 25 19:10:47 UTC 2008
Hi Johan,
Thanks for your help. And also thanks to Kai for the FreeBSD news server.
For Shaun (the FreeBSD maintainer), here is the history of the thread
in the mailing list:
http://marc.info/?t=122460141500003&r=1&w=2
I suggest the following patch for inclusion in the FreeBSD port of INN:
http://inn.eyrie.org/viewcvs/branches/2.4/nnrpd/nnrpd.c?r1=7953&r2=8144&view=patch
(I cannot use SA_LEN because ssa is not defined before binding.)
The port of INN 2.4
http://www.freebsd.org/cgi/cvsweb.cgi/ports/news/inn/
should be updated with the update to INN 2.4.5
http://www.freebsd.org/cgi/query-pr.cgi?pr=126651
and the patch above.
It would also be great to have a working INN 2.5... It has been marked as broken
for two years!
http://www.freebsd.org/cgi/cvsweb.cgi/ports/news/inn-current/
Thanks,
--
Julien ÉLIE
--- branches/2.4/nnrpd/nnrpd.c 2008/08/23 13:45:02 7953
+++ branches/2.4/nnrpd/nnrpd.c 2008/10/25 17:06:15 8144
@@ -804,9 +804,9 @@
struct timeval tv;
unsigned short ListenPort = NNTP_PORT;
#ifdef HAVE_INET6
- char ListenAddr[INET6_ADDRSTRLEN];
+ char ListenAddr[INET6_ADDRSTRLEN] = "::0";
#else
- char ListenAddr[16];
+ char ListenAddr[16] = "0.0.0.0";
#endif
int lfd, fd;
socklen_t clen;
@@ -948,11 +948,14 @@
SPOOLlen = strlen(innconf->patharticles);
if (DaemonMode) {
+ bool ipv4binding = true;
+
#ifdef HAVE_INET6
memset(&ssa, '\0', sizeof(struct sockaddr_in6));
ssa6->sin6_family = AF_INET6;
ssa6->sin6_port = htons(ListenPort);
if (inet_pton(AF_INET6, ListenAddr, ssa6->sin6_addr.s6_addr) > 0) {
+ ipv4binding = false;
if ( (lfd = socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
syslog(L_FATAL, "can't open socket (%m)");
exit(1);
@@ -979,7 +982,9 @@
exit(1);
}
- if (bind(lfd, (struct sockaddr *) &ssa, sizeof(ssa)) < 0) {
+ if (bind(lfd, (struct sockaddr *) &ssa,
+ ipv4binding ? sizeof(struct sockaddr_in)
+ : sizeof(struct sockaddr_storage)) < 0) {
fprintf(stderr, "%s: can't bind (%s)\n", argv[0], strerror(errno));
syslog(L_FATAL, "can't bind local address (%m)");
exit(1);
More information about the inn-workers
mailing list