From e5bb9bcb8dadc3cadd46df7f4d5651fbebbd17ce Mon Sep 17 00:00:00 2001 From: Arceliar Date: Fri, 26 Jul 2019 17:44:40 -0500 Subject: [PATCH 1/5] change how searches are initialized so we actually send a dhtReq to ourself and get a response, in case we're the destination --- src/yggdrasil/search.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/yggdrasil/search.go b/src/yggdrasil/search.go index d8c9049a..4c31fd6b 100644 --- a/src/yggdrasil/search.go +++ b/src/yggdrasil/search.go @@ -179,8 +179,12 @@ func (sinfo *searchInfo) continueSearch() { // Calls create search, and initializes the iterative search parts of the struct before returning it. func (s *searches) newIterSearch(dest *crypto.NodeID, mask *crypto.NodeID, callback func(*sessionInfo, error)) *searchInfo { sinfo := s.createSearch(dest, mask, callback) - sinfo.toVisit = s.core.dht.lookup(dest, true) sinfo.visited = make(map[crypto.NodeID]bool) + loc := s.core.switchTable.getLocator() + sinfo.toVisit = append(sinfo.toVisit, &dhtInfo{ + key: s.core.boxPub, + coords: loc.getCoords(), + }) // Start the search by asking ourself, useful if we're the destination return sinfo } From 195d577151dde9c3aa01cdfc82161ac9250e9c1e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 27 Jul 2019 13:30:47 +0100 Subject: [PATCH 2/5] Add IFF_NODAD/IFF_SECURED, define consts --- src/tuntap/tun_darwin.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tuntap/tun_darwin.go b/src/tuntap/tun_darwin.go index 5dfca137..d7b46537 100644 --- a/src/tuntap/tun_darwin.go +++ b/src/tuntap/tun_darwin.go @@ -30,7 +30,12 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int return tun.setupAddress(addr) } -const darwin_SIOCAIFADDR_IN6 = 2155899162 +const ( + darwin_SIOCAIFADDR_IN6 = 2155899162 // netinet6/in6_var.h + darwin_IN6_IFF_NODAD = 0x0020 // netinet6/in6_var.h + darwin_IN6_IFF_SECURED = 0x0400 // netinet6/in6_var.h + darwin_ND6_INFINITE_LIFETIME = 0xFFFFFFFF // netinet6/nd6.h +) type in6_addrlifetime struct { ia6t_expire float64 @@ -91,8 +96,11 @@ func (tun *TunAdapter) setupAddress(addr string) error { ar.ifra_addr.sin6_addr[i] = uint16(binary.BigEndian.Uint16(b)) } - ar.ifra_lifetime.ia6t_vltime = 0xFFFFFFFF - ar.ifra_lifetime.ia6t_pltime = 0xFFFFFFFF + ar.ifra_flags |= darwin_IN6_IFF_NODAD + ar.ifra_flags |= darwin_IN6_IFF_SECURED + + ar.ifra_lifetime.ia6t_vltime = darwin_ND6_INFINITE_LIFETIME + ar.ifra_lifetime.ia6t_pltime = darwin_ND6_INFINITE_LIFETIME var ir ifreq copy(ir.ifr_name[:], tun.iface.Name()) From 4d4fa84123c2b8c47ff71ce569165c3c38e8d59d Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 27 Jul 2019 13:57:19 +0100 Subject: [PATCH 3/5] Hopefully fix CircleCI builds on PRs --- .circleci/config.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2bd5b03f..0bf62c5f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,7 @@ jobs: echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV + echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' case "$CINAME" in \ "yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \ "yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \ @@ -53,9 +54,9 @@ jobs: name: Build for Linux (RPM packages) command: | git clone https://github.com/yggdrasil-network/yggdrasil-package-rpm ~/rpmbuild/SPECS - cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIRCLE_BRANCH-$CIVERSIONRPM/" project - sed -i "s/yggdrasil-go/yggdrasil-go-$CIRCLE_BRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec - sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIRCLE_BRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec + cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIBRANCH-$CIVERSIONRPM/" project + sed -i "s/yggdrasil-go/yggdrasil-go-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec + sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/yggdrasil.spec sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/yggdrasil.spec sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/yggdrasil.spec From d81310538602ad716631b811c9cf9073ee667972 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 27 Jul 2019 14:11:03 +0100 Subject: [PATCH 4/5] Export CIBRANCH to Bash env --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0bf62c5f..36fd6783 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,7 +17,7 @@ jobs: echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV - echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' + echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' >> $BASH_ENV case "$CINAME" in \ "yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \ "yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \ From ad4ba6871e8a536e31abb7a43e93497fb44ba413 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sat, 27 Jul 2019 14:15:07 +0100 Subject: [PATCH 5/5] Use Go 1.12.7 for macOS builds --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 36fd6783..f9cd0720 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,11 +32,11 @@ jobs: sudo apt-get install -y rpm file mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS - # - run: - # name: Test debug builds - # command: | - # ./build -d - # test -f yggdrasil && test -f yggdrasilctl + - run: + name: Test debug builds + command: | + ./build -d + test -f yggdrasil && test -f yggdrasilctl - run: name: Build for Linux (including Debian packages) @@ -102,11 +102,11 @@ jobs: echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - run: - name: Install Go 1.12 + name: Install Go 1.12.7 command: | cd /tmp - curl -LO https://dl.google.com/go/go1.12.darwin-amd64.pkg - sudo installer -pkg /tmp/go1.12.darwin-amd64.pkg -target / + curl -LO https://dl.google.com/go/go1.12.7.darwin-amd64.pkg + sudo installer -pkg /tmp/go1.12.7.darwin-amd64.pkg -target / #- run: # name: Install Gomobile