On Thu, Oct 25, 2018 at 09:26:51PM +0200, Juliusz Chroboczek wrote:
Also it would be really helpful if that remaining PR (prefsrc) could be
considered.
Sure! I attached the two patches on this mail.

Patch 0001 removes outdated information from the manpage
Patch 0002 adds prefsrc capabilities
Patch 0003 fixes a build issue in rfc6126bis in message.c



viele Grüße

Christof




Christof, are you willing to send me a clean patch against the rfc6126bis
branch, or shall I do the merge myself?

-- Juliusz

--
()  ascii ribbon campaign - against html e-mail
/\  against proprietary attachments

From d53d375a216aef30f81973651e401c25472def36 Mon Sep 17 00:00:00 2001
From: Christof Schulze <[email protected]>
Date: Wed, 4 Jul 2018 22:33:13 +0200
Subject: [PATCH 1/3] manpage: remove reference in the description of -S to the
 non-existing -P flag

---
 babeld.man | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/babeld.man b/babeld.man
index 116b3d5..5cb281e 100644
--- a/babeld.man
+++ b/babeld.man
@@ -34,9 +34,8 @@ Set the name of the file used for preserving long-term information
 between invocations of the
 .B babeld
 daemon.  If this file is deleted, the daemon will run in passive mode
-for 3 minutes when it is next started (see
-.B -P
-below), and other hosts might initially ignore it.  The default is
+for 3 minutes when it is next started, and other hosts might initially
+ignore it. The default is
 .BR /var/lib/babel-state .
 .TP
 .BI \-h " hello-interval"
-- 
2.11.0

From 8d91796085159acbe42e954f44af0f07b9d6e4a3 Mon Sep 17 00:00:00 2001
From: Christof Schulze <[email protected]>
Date: Wed, 4 Jul 2018 21:40:10 +0200
Subject: [PATCH 2/3] allow selecting a preferred source address per interface

This preferred source address will be added as prefsrc stanza to each
exported route via this interface. For this the interface configuration
is extended by the parameter pref-src requiring an ipv6 address as
argument.
---
 babeld.man       |  4 ++++
 configuration.c  |  9 +++++++++
 interface.h      | 14 +++++++++-----
 kernel_netlink.c | 11 +++++++++++
 4 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/babeld.man b/babeld.man
index 5cb281e..8a3b325 100644
--- a/babeld.man
+++ b/babeld.man
@@ -357,6 +357,10 @@ This specifies whether link quality estimation should be performed on this
 interface.  The default is to perform link quality estimation on wireless
 interfaces only.
 .TP
+.BR pref-src " {" ipv6-address }
+This specifies the preferred src address to be added to routes on this
+interface.
+.TP
 .BR split\-horizon " {" true | false | auto }
 This specifies whether to perform split-horizon processing on this
 interface.  The default is to perform split-horizon processing on
diff --git a/configuration.c b/configuration.c
index 6a11d53..9670055 100644
--- a/configuration.c
+++ b/configuration.c
@@ -574,6 +574,14 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
             if(c < -1)
                 goto error;
             if_conf->lq = v;
+	} else if(strcmp(token, "pref-src") == 0) {
+            unsigned char *prefsrc = NULL;
+            c = getip(c, &prefsrc, NULL, gnc, closure);
+            if(c < -1)
+                goto error;
+            memcpy(if_conf->prefsrc, prefsrc, 16);
+	    if_conf->use_prefsrc = 1;
+            free(prefsrc);
         } else if(strcmp(token, "split-horizon") == 0) {
             int v;
             c = getbool(c, &v, gnc, closure);
@@ -716,6 +724,7 @@ merge_ifconf(struct interface_conf *dest,
     MERGE(update_interval);
     MERGE(cost);
     MERGE(type);
+    MERGE(use_prefsrc);
     MERGE(split_horizon);
     MERGE(lq);
     MERGE(faraway);
diff --git a/interface.h b/interface.h
index 782979a..469bedb 100644
--- a/interface.h
+++ b/interface.h
@@ -41,11 +41,6 @@ struct interface_conf {
     unsigned hello_interval;
     unsigned update_interval;
     unsigned short cost;
-    char type;
-    char split_horizon;
-    char lq;
-    char faraway;
-    char unicast;
     int channel;
     int enable_timestamps;
     int rfc6126;
@@ -53,6 +48,13 @@ struct interface_conf {
     unsigned int rtt_min;
     unsigned int rtt_max;
     unsigned int max_rtt_penalty;
+    char type;
+    char split_horizon;
+    char lq;
+    char faraway;
+    char use_prefsrc;
+    char unicast;
+    unsigned char prefsrc[16];
     struct interface_conf *next;
 };
 
@@ -72,6 +74,8 @@ struct interface_conf {
 #define IF_FARAWAY (1 << 4)
 /* Send most TLVs over unicast. */
 #define IF_UNICAST (1 << 5)
+/* use preferred source address on this interface */
+#define IF_PREFSRC (1 << 6)
 
 /* Only INTERFERING can appear on the wire. */
 #define IF_CHANNEL_UNKNOWN 0
diff --git a/kernel_netlink.c b/kernel_netlink.c
index 479c803..99c01ff 100644
--- a/kernel_netlink.c
+++ b/kernel_netlink.c
@@ -1054,6 +1054,17 @@ kernel_route(int operation, int table,
             rta->rta_type = RTA_SRC;
             memcpy(RTA_DATA(rta), src, sizeof(struct in6_addr));
         }
+
+        struct interface *ifp;
+
+        FOR_ALL_INTERFACES(ifp) {
+            if ( (ifp->ifindex == ifindex)  &&  (ifp->conf->use_prefsrc == 1 ) ) {
+                rta = RTA_NEXT(rta, len);
+                rta->rta_len = RTA_LENGTH(sizeof(struct in6_addr));
+                rta->rta_type = RTA_PREFSRC;
+                memcpy(RTA_DATA(rta), ifp->conf->prefsrc, sizeof(struct in6_addr));
+            }
+        }
     }
 
     rta = RTA_NEXT(rta, len);
-- 
2.11.0

From 79fb8b5e5a17bdd61585d23bfa6269a4376ab9fc Mon Sep 17 00:00:00 2001
From: Christof Schulze <[email protected]>
Date: Tue, 30 Oct 2018 19:57:58 +0100
Subject: [PATCH 3/3] message.c: FIX build error in send_multihop_request(),
 ifp undefined

---
 message.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/message.c b/message.c
index 6bfca5b..b3212f6 100644
--- a/message.c
+++ b/message.c
@@ -1795,9 +1795,6 @@ send_multihop_request(struct buffered *buf,
     int v4, pb, spb, len;
     int is_ss = !is_default(src_prefix, src_plen);
 
-    if(!if_up(ifp))
-        return;
-
     if(is_ss && buf->rfc6126_compatible)
         return;
 
@@ -1883,7 +1880,8 @@ send_unicast_multihop_request(struct neighbour *neigh,
                               unsigned short hop_count)
 {
     flushupdates(neigh->ifp);
-    send_multihop_request(&neigh->buf, prefix, plen, src_prefix, src_plen,
+    if(if_up(neigh->ifp))
+        send_multihop_request(&neigh->buf, prefix, plen, src_prefix, src_plen,
                           seqno, id, hop_count);
 }
 
@@ -1906,9 +1904,11 @@ send_request_resend(const unsigned char *prefix, unsigned char plen,
                       id, neigh->ifp, resend_delay);
     } else {
         struct interface *ifp;
-        FOR_ALL_INTERFACES(ifp)
-            send_multihop_request(&ifp->buf, prefix, plen, src_prefix, src_plen,
+        FOR_ALL_INTERFACES(ifp) {
+            if(if_up(ifp))
+                send_multihop_request(&ifp->buf, prefix, plen, src_prefix, src_plen,
                                   seqno, id, 127);
+	}
     }
 }
 
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

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

Reply via email to