d@nuc-client:~/git/babeld$ ./babeld -v
babeld-1.5.1-65-g8950d3b IPV6_SUBTREES built 02:51:33 Apr  5 2015

I must have 11 different versions of babel deployed on my network
by now, and it is going to be a hassle to track them all down to fully
deploy the source specific stuff next month.

1) It is not clear to me how to generate a release tarball with the
VERSION file,
instead of git.

I bummed the tiny script from the dnsmasq tree to parse the release
tags and supply the git commit it was based on. Hopefully simon has
madness and method somewhere. bugging him.

(why is it I am always working on dnsmasq AND babel at the same time?)

(no, simon, I have not get any more dnssec testing done yet. Tomorrow (today))

2) I thought about adding the version to the info supplied to
babelweb, but did not poke there

3) It is not clear from reading the man page if diversity routing and
rtt based stuff
can be enabled at the same time. If both are set, who wins?

4) Also, diversity routing is the default for me, and I would suspect
the default for others, so I would suggest flipping the default to
true in 1.6.

I am not big on inline patches (from gmail), so it is attached and
also available here.

http://snapon.lab.bufferbloat.net/~d/0001-Add-support-for-a-version-string.patch

Should I use github pull requests instead?
-- 
Dave Täht
Let's make wifi fast, less jittery and reliable again!

https://plus.google.com/u/0/107942175615993706558/posts/TVX3o84jjmb
From 1c95e78e1cb6f05f2cd4132ad4b5d41c2fd7dead Mon Sep 17 00:00:00 2001
From: Dave Taht <[email protected]>
Date: Sun, 5 Apr 2015 02:58:57 -0700
Subject: [PATCH] Add support for a version string

It is sometimes difficult to know what babel versions are deployed.
This makes it explicit, including whether or not ipv6 subtrees is
enabled.
---
 Makefile    |  3 ++-
 babeld.c    | 15 +++++++++++++--
 babeld.man  |  4 ++++
 get-version | 30 ++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100755 get-version

diff --git a/Makefile b/Makefile
index ae55b09..1bbb100 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
 PREFIX = /usr/local
 MANDIR = $(PREFIX)/share/man
+VERSION := $(shell ./get-version)
 
 CDEBUGFLAGS = -Os -g -Wall
 
-DEFINES = $(PLATFORM_DEFINES)
+DEFINES = $(PLATFORM_DEFINES) -DVERSION=\"$(VERSION)\"
 
 CFLAGS = $(CDEBUGFLAGS) $(DEFINES) $(EXTRA_DEFINES)
 
diff --git a/babeld.c b/babeld.c
index 09c31a5..c84b888 100644
--- a/babeld.c
+++ b/babeld.c
@@ -96,6 +96,12 @@ static void init_signals(void);
 static void dump_tables(FILE *out);
 static int reopen_logfile(void);
 
+#if defined(IPV6_SUBTREES)
+#define HAVE_SUBTREES "IPV6_SUBTREES"
+#else
+#define HAVE_SUBTREES "NO IPV6_SUBTREES"
+#endif
+
 int
 main(int argc, char **argv)
 {
@@ -124,11 +130,16 @@ main(int argc, char **argv)
     change_smoothing_half_life(4);
 
     while(1) {
-        opt = getopt(argc, argv, "m:p:h:H:i:k:A:sruS:d:g:lwz:M:t:T:c:C:DL:I:");
+        opt = getopt(argc, argv,
+		     "m:p:h:H:i:k:A:sruS:d:g:lwvz:M:t:T:c:C:DL:I:");
         if(opt < 0)
             break;
 
         switch(opt) {
+	case 'v':
+	    fprintf(stdout, VERSION " " HAVE_SUBTREES " built "
+		    __TIME__ " " __DATE__ "\n" );
+	    exit(0);
         case 'm':
             rc = parse_address(optarg, protocol_group, NULL);
             if(rc < 0)
@@ -819,7 +830,7 @@ main(int argc, char **argv)
             "                "
             "[-t table] [-T table] [-c file] [-C statement]\n"
             "                "
-            "[-d level] [-D] [-L logfile] [-I pidfile]\n"
+            "[-d level] [-D] [-v] [-L logfile] [-I pidfile]\n"
             "                "
             "[id] interface...\n",
             argv[0]);
diff --git a/babeld.man b/babeld.man
index 8fdad59..55e9f71 100644
--- a/babeld.man
+++ b/babeld.man
@@ -17,6 +17,10 @@ While it is optimised for wireless mesh networks, Babel will also work
 efficiently on wired networks.
 .SH OPTIONS
 .TP
+.BI \-v
+.TP
+Print the babel version and exit.
+.TP
 .BI \-m " multicast-address"
 Specify the link-local multicast address to be used by the protocol.
 The default is
diff --git a/get-version b/get-version
new file mode 100755
index 0000000..11989d1
--- /dev/null
+++ b/get-version
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Determine the version string to build into a binary.
+# When building in the git repository, we can use the output 
+# of "git describe" which gives an unequivocal answer.
+#
+# Failing that, we use the contents of the VERSION file
+# which has a set of references substituted into it by git.
+# 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.
+# If there is more than one v[0-9].* tag, sort them and use the
+# first. This favours, eg v2.63 over 2.63rc6.
+
+if which git >/dev/null 2>&1 && [ -d .git ]; then
+     git describe | sed 's/^v//'
+elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
+# unsubstituted VERSION, but no git available.
+    echo UNKNOWN
+else
+     vers=`cat VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
+
+     if [ $? -eq 0 ]; then
+         echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
+     else
+         cat VERSION
+     fi
+fi
+
+exit 0
+
-- 
1.9.1

_______________________________________________
Babel-users mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/babel-users

Reply via email to