Hi all,

relayd refuse to start on a WITHOUT_INET6 kernel and display this error message:
fatal: icmp_init: socket: Protocol not supported

Here is a patch for testing the presence of INET6 before calling icmp_setup():
http://pastebin.com/w3dkXJPP

Regards,
Olivier

--- usr.sbin/relayd/check_icmp.c.orig   Tue Mar 20 17:52:56 2012
+++ usr.sbin/relayd/check_icmp.c        Mon Apr  2 13:54:30 2012
@@ -67,10 +67,17 @@
 void
 icmp_init(struct relayd *env)
 {
+       int mib[2];
+       size_t len;
        icmp_setup(env, &env->sc_icmp_send, AF_INET);
        icmp_setup(env, &env->sc_icmp_recv, AF_INET);
-       icmp_setup(env, &env->sc_icmp6_send, AF_INET6);
-       icmp_setup(env, &env->sc_icmp6_recv, AF_INET6);
+       /* setup INET6 only if net.inet6 exist */
+       mib[0] = CTL_NET;
+       mib[1] = AF_INET6;
+       if (sysctl(mib, 2, NULL, &len, NULL, 0) != -1) {
+               icmp_setup(env, &env->sc_icmp6_send, AF_INET6);
+               icmp_setup(env, &env->sc_icmp6_recv, AF_INET6);
+       }
        env->sc_id = getpid() & 0xffff;
 }

Reply via email to