[link-detect] Try to get BSD link-detect to work properly.

2008-01-10 Ingo Flaschberger <if@xip.at>

	* configure.ac: Define HAVE_BSD_LINK_DETECT if <net/if_media.h> is
	  present.
	* lib/zebra.h: If HAVE_BSD_LINK_DETECT is defined,
	  include <net/if_media.h>.
	* zebra/ioctl.c: (if_get_flags) If HAVE_BSD_LINK_DETECT, use the
	  SIOCGIFMEDIA ioctl to ascertain link state.
	* zebra/kernel_socket.c: (bsd_linkdetect_translate) New function to
	  map the ifm_data.ifi_link_state value into the IFF_RUNNING flag.
	  (ifm_read) Call bsd_linkdetect_translate to fix the IFF_RUNNING
	  flag before calling if_flags_update.
diff --git a/lib/ChangeLog b/lib/ChangeLog
index bbbdfab..21d08dd 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2008-01-10 Ingo Flaschberger <if@xip.at>
+
+	* zebra.h: If HAVE_BSD_LINK_DETECT is defined, include <net/if_media.h>.
+
 2008-01-08 Pavol Rusnak <prusnak@suse.cz>
 
 	* memory.c: (mtype_memstr) Fix accidental shift past width of type,
diff --git a/lib/zebra.h b/lib/zebra.h
index 150aa2c..1c9eb39 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -116,6 +116,9 @@
 #endif /* !va_copy */
 #endif /* !C99 */
 
+#ifdef HAVE_BSD_LINK_DETECT
+#include <net/if_media.h>
+#endif /* HAVE_BSD_LINK_DETECT*/
 
 #ifdef HAVE_LCAPS
 #include <sys/capability.h>