> Wouldn't it be easier to do something like I did with BIND -- detect 
> the "protocol not available" (ENOPROTOOPT?) and don't use the feature, 
> instead of calling it an error...  

That was my thought.  These patches should do it.

--- traceroute-4.4BSD/traceroute.c      Sun Jan 28 22:47:27 1996
+++ traceroute.c        Wed Jun 19 06:36:15 1996
@@ -310,6 +310,9 @@
        struct protoent *pe;
        struct sockaddr_in from, *to;
        int ch, i, on, probe, seq, tos, ttl;
+#ifdef IP_HDRINCL
+       int hdrincl_works = 1;
+#endif
 
        on = 1;
        seq = tos = 0;
@@ -454,8 +457,12 @@
 #ifdef IP_HDRINCL
        if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL, (char *)&on,
                       sizeof(on)) < 0) {
-               perror("traceroute: IP_HDRINCL");
-               exit(6);
+               if (errno == ENOPROTOOPT) {
+                       hdrincl_works = 0;
+               } else {
+                       perror("traceroute: IP_HDRINCL");
+                       exit(6);
+               }
        }
 #endif IP_HDRINCL
        if (options & SO_DEBUG)
@@ -475,7 +482,7 @@
                }
                outpacket->ip.ip_src = from.sin_addr;
 #ifndef IP_HDRINCL
-               if (bind(sndsock, (struct sockaddr *)&from, sizeof(from)) < 0) {
+               if (hdrincl_works && bind(sndsock, (struct sockaddr *)&from, 
sizeof(from)) < 0) {
                        perror ("traceroute: bind:");
                        exit (1);
                }
-- 
Shields, CrossLink.

Reply via email to