Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlvpn: Add package (Multi-Link Virtual Public Network) #4271

Closed
wants to merge 1 commit into from

Conversation

azuwis
Copy link
Contributor

@azuwis azuwis commented Apr 17, 2017

Maintainer: me / @azuwis
Compile tested: (ramips/mt7621, ZBT-WG3526, LEDE r3972)
Run tested: (ramips/mt7621, ZBT-WG3526, LEDE r3972, tests done)

Description:
mlvpn is Multi-Link Virtual Public Network, MLVPN will do its best to achieve the following tasks:

  • Bond your internet links to increase bandwidth (unlimited).
  • Secure your internet connection by actively monitoring your links and removing the faulty ones, without loosing your TCP connections.
  • Secure your internet connection to the aggregation server using strong cryptography.
  • Scriptable automation and monitoring.

See mlvpn homepage for more info.

@diizzyy
Copy link
Contributor

diizzyy commented Apr 17, 2017

Please assign copyright to yourself and/or omit it. Change gz to xz and add PKG_MIRROR_HASH.

@azuwis azuwis force-pushed the mlvpn branch 2 times, most recently from 381e038 to b34d2a9 Compare April 17, 2017 13:30
@azuwis
Copy link
Contributor Author

azuwis commented Apr 17, 2017

All done. Please check the amended commit.

@diizzyy
Copy link
Contributor

diizzyy commented Apr 17, 2017

@hnyman
Does the .upgrade stuff apply to LEDE/OpenWRT?

@azuwis
Copy link
Contributor Author

azuwis commented Apr 18, 2017

The sysupgrade code is copied from openvpn package, see OpenWRT openvpn package and LEDE openvpn package

@hnyman hnyman changed the title mlvpn: Add package mlvpn: Add package (Multi-Link Virtual Public Network) Apr 19, 2017
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mlvpn $(1)/usr/sbin/
install -m0700 files/mlvpn-updown $(1)/usr/sbin/
$(INSTALL_BIN) files/mlvpn.init $(1)/etc/init.d/mlvpn
$(INSTALL_DATA) files/mlvpn.upgrade $(1)/lib/upgrade/keep.d/mlvpn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this instead manually adding the file to /lib/upgrade/keep.d/mlvpn please:
define Package/mlvpn/conffiles
/etc/mlvpn/
endef

It will have the same effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@trungpham
Copy link

Will this be merged soon? How about LEDE?

@Stratehm
Copy link

Hi,

I have build this package for LEDE x86_64 (running on KVM). I use it as a client, but I have a bug when I try to bind a tunnel to an interface address with the "bindhost" option. Without this option, all works fine.

When I try mlvpn on Debian 9, all works fine with the same configuration file.

Here are the output of his command:
root@LEDE:~# mlvpn --config /etc/mlvpn/mlvpn0.conf --user nobody --debug -vv

2017-11-24T22:54:48 [ DBG] absolute maximum mtu: 1444
2017-11-24T22:54:48 [INFO/config] new password set
2017-11-24T22:54:48 [INFO/config] reorder_buffer_size changed from 0 to 64
2017-11-24T22:54:48 [INFO/config] adsl tunnel added
2017-11-24T22:54:48 [INFO/config] 4g tunnel added
2017-11-24T22:54:48 [INFO] created interface `mlvpn0'
2017-11-24T22:54:48 [ DBG/wrr] 4g weight = 26.315789 (100000 380000)
2017-11-24T22:54:48 [ DBG/wrr] adsl weight = 73.684211 (280000 380000)
2017-11-24T22:54:48 [ DBG/protocol] adsl mlvpn_rtun_challenge_send
2017-11-24T22:54:48 [INFO] 4g bind to 192.168.15.1
2017-11-24T22:54:48 [WARN] 4g bind error: Invalid argument
2017-11-24T22:54:48 [ DBG/net] > adsl sent 46 bytes (size=2, type=0, seq=0, reorder=1)
2017-11-24T22:54:48 [ DBG/rtt] 17ms srtt 17ms loss ratio: 0
2017-11-24T22:54:48 [ DBG/net] < adsl recv 46 bytes (type=1, seq=0, reorder=1)
2017-11-24T22:54:48 [INFO/protocol] adsl authenticated
2017-11-24T22:54:49 [ DBG/reorder] adjusting reordering drain timeout to 112ms
2017-11-24T22:54:49 [INFO] 4g bind to 192.168.15.1

The command ends after the last line.

When I read the log, I can see a segfault:
Thu Nov 23 09:33:37 2017 kern.info kernel: [469203.403092] mlvpn[32650]: segfault at 10 ip 0000000000407ff3 sp 00007ffe7574b2c0 error 4 in mlvpn[400000+f000]

I saw you have already added a patch for musl compatibility...
Do you think it may be an incompatibility with the bind() or getaddrinfo() functions of musl?

Here is the config file:

[general]
statuscommand = "/etc/mlvpn/mlvpn0_updown.sh"
tuntap = "tun"
mode = "client"
interface_name = "mlvpn0"
timeout = 30
password = "xxxxxxxxxxxxxxxxxxxxxx"
reorder_buffer_size = 64
loss_tolerence = 10

[filters]

[adsl]
remotehost = "xxxxxxxxxx"
remoteport = 5080
bandwidth_upload = 280000

[4g]
remotehost = "xxxxxxxxxx"
remoteport = 5081
bindhost = "192.168.15.1"
bandwidth_upload = 100000

Thank you.

@savalyksergey
Copy link

savalyksergey commented Jan 2, 2018

regarding this error it happens in the trunk version which uses the last linux kernel, try to use Chaos Calmer and the segfault will go away, and please, share your configs and setup if you have a successful run

@diizzyy
Copy link
Contributor

diizzyy commented Dec 30, 2018

Does it still segfault on a recent version (master) of OpenWrt?

@savalyksergey
Copy link

sorry, i did not check it for months but it should, because there was no commits since then

@diizzyy
Copy link
Contributor

diizzyy commented Jan 31, 2019

@hnyman @thess
Close due to submitter timeout

@neheb
Copy link
Contributor

neheb commented Mar 29, 2019

ping @azuwis If you want this in, please rebase against current master

@azuwis
Copy link
Contributor Author

azuwis commented Apr 1, 2019

@Stratehm @savalyksergey Sorry for the late replay. I've no idea about the segfault. The musl patch was a trivial one.

@neheb I've rebased and force-pushed, also updated mlvpn to 2.3.2. Compile tested, but not run tested.

I don't use mlvpn any longer, so I'd like to leave it here for anyone interested to continue the work.

@neheb
Copy link
Contributor

neheb commented Apr 4, 2019

Interestingly enough, there's a version 2.3.3 as part of the debian-stretch branch.

@azuwis
Copy link
Contributor Author

azuwis commented Apr 6, 2019

It seems 2.3.3 is only for Debian packaging, git diff --stat 2.3.2..origin/debian-unstable gives no c code changes, only Debian packaging stuff.


PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zehome/MLVPN.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implicit. Remove.

PKG_SOURCE_URL:=https://github.com/zehome/MLVPN.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=6f13423b8108f46edb9f230deee20e3741abe64c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implicit. Remove.

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=e77916143162ffa050bc07482264f726b0c03a8fa9e07bb594a3759f512830cd

PKG_LICENSE:=BSD-2-Clause
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap order between PKG_LICENSE and PKG_MAINTAINER.

Add PKG_LICENSE_FILES:=LICENCE

{
if [ "$unamestr" = "Linux" ]; then
ip link set dev "$DEVICE" mtu "$MTU" up
if [ ! -z "$IP4" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck throws numerous instances of:

SC2236: Use -n instead of ! -z.

https://github.com/koalaman/shellcheck/wiki/SC2236

via=""
if [ "$family" = "4" ]; then
[ -z "$IP4_GATEWAY" ] || via="via $IP4_GATEWAY"
ip -4 route add "$route" $via dev "$DEVICE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck says $via should be quoted.

ip -4 route add "$route" $via dev "$DEVICE"
elif [ "$family" = "6" ]; then
[ -z "$IP6_GATEWAY" ] || via="via $IP6_GATEWAY"
ip -6 route add "$route" $via dev "$DEVICE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck says $via should be quoted.

Signed-off-by: Zhong Jianxin <azuwis@gmail.com>
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include $(TOPDIR)/rules.mk
include $(TOPDIR)/rules.mk

PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/package.mk


include $(INCLUDE_DIR)/package.mk

define Package/mlvpn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
define Package/mlvpn
define Package/mlvpn

@diizzyy
Copy link
Contributor

diizzyy commented Apr 18, 2020

@neheb @BKPepe @hnyman
I think we can close this as it's broken on trunk?

@neheb
Copy link
Contributor

neheb commented Apr 18, 2020

We have plenty of VPNs already

@neheb
Copy link
Contributor

neheb commented May 31, 2020

Going to close this. There doesn't seem to be anyone interested.

@neheb neheb closed this May 31, 2020
@ghost
Copy link

ghost commented Oct 14, 2020

We have plenty of VPNs already

This is not yet another VPN, it's mainly used for aggregation.
ubond seems to be updated fork.

@arinc9
Copy link

arinc9 commented Jan 22, 2021

Tuning in here for interest. I'd love to see MLVPN on upstream.

@arinc9
Copy link

arinc9 commented Mar 31, 2021

MLVPN on OpenWrt authenticates with server and can transmit packets over the tunnel just fine.
However, it will exit with exitcode 1 when trying to bind to an interface IP.

I wanted to see if this would happen on ubond as well because of it being based off of MLVPN.

Referring from markfoodyburton/ubond#7

There's this error on the log:

ubond.c: In function 'ubond_rtun_bind':
ubond.c:1150:56: error: format not a string literal and no format arguments [-Werror=format-security]
       snprintf(ifr.ifr_name, sizeof(ifr.ifr_name) - 1, t->binddev);
                                                        ^

MLVPN will compile fine without this error but will exit with exitcode 1 when trying to bind to an interface IP.

Might there be something wrong with binding to interface IPs on MLVPN and ubond which makes this feature break on OpenWrt?

I believe a patch in the right place could solve this issue for compiling and make binding work on OpenWrt.

paging @azuwis @markfoodyburton @zehome

@markfoodyburton
Copy link

While MLVPN and Ubond 'diverged' somewhat significantly, I'm afraid much of the boilerplate remains the same, so it's likely that both will suffer the same issues with devices - however, millage may differ.

(Ubond tries to do a few things that MLVPN does not - it tries to load balance better, and it tries to 'auto adjust' to speeds - it also tries to reduce packet loss on noisy channels, and it tries to fail-over seamlessly. All good, the bad is that "it works for me", parts of the support for different things that MLVPN had, are just 'left dangling' and probably broken in ubond - YMMV)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet