Tweaks to fix compilation on FreeBSD.
diff --git a/bld/get-version b/bld/get-version
index 42849ce..72bd349 100755
--- a/bld/get-version
+++ b/bld/get-version
@@ -9,11 +9,14 @@
 # If we can find one which matches $v[0-9].* then we assume it's
 # a version-number tag, else we just use the whole string.
 
-# we're called with pwd == src
+# we're called with pwd == TLD
 cd ..
 
-if [ -d .git ]; then
+if which git >/dev/null 2>&1 && [ -d .git ]; then
      git describe
+elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
+# unsubstituted VERSION, but no git available.
+    echo UNKNOWN
 else
      vers=`cat VERSION | sed 's/[(), ]/\n/ g' | grep -m 1 $v[0-9]`
 
diff --git a/src/bpf.c b/src/bpf.c
index 4251313..789c718 100644
--- a/src/bpf.c
+++ b/src/bpf.c
@@ -160,11 +160,11 @@
 	  unsigned int flags;
 	  if (ioctl(fd, SIOCGIFFLAGS, ifr) != -1)
 	    {
-	      flags = ifr.ifr_flags;
+	      flags = ifr->ifr_flags;
 	      ifr->ifr_addr.sa_family = AF_LINK;
 	      if (ioctl(fd, SIOCGIFADDR, ifr) != -1 &&
-		  !((*callback)((unsigned int) htons(ETHERTYPE_IP), 
-				(unsigned int)link->ifi_flags,
+		  !((*callback)((unsigned int)htons(ETHERTYPE_IP), 
+				flags,
 				LLADDR((struct sockaddr_dl *)&ifr->ifr_addr), ETHER_ADDR_LEN, parm)))
 		goto err;
 	    }
diff --git a/src/dhcp6.c b/src/dhcp6.c
index 7f66436..27f22b1 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -212,7 +212,7 @@
   lease_prune(NULL, now); /* lose any expired leases */
 
   msg.msg_iov =  &daemon->dhcp_packet;
-  sz = dhcp6_reply(parm.current, if_index, ifr.ifr_name, sz, IN6_IS_ADDR_MULTICAST(&from), now);
+  sz = dhcp6_reply(parm.current, if_index, ifr.ifr_name, sz, IN6_IS_ADDR_MULTICAST(&from.in6.sin6_addr), now);
   
   lease_update_file(now);
   lease_update_dns();
diff --git a/src/rfc3315.c b/src/rfc3315.c
index 54e0e91..9cfcf84 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -467,7 +467,7 @@
 	    int iaid, ia_type = opt6_type(opt);
 	    void *ia_option, *ia_end;
 	    unsigned int min_time = 0xffffffff;
-	    int t1cntr;
+	    int t1cntr = 0;
 	    int address_assigned = 0;
 	    
 	    if (ia_type != OPTION6_IA_NA && ia_type != OPTION6_IA_TA)