FORUMS
Remove All Ads from XDA

WireGuard Kernel/ROM Integration

198 posts
Thanks Meter: 799
 
Post Reply Email Thread
Announcement from zx2c4: WireGuard available for custom Kernel/ROM integration
29th November 2017, 12:54 PM |#21  
Senior Member
Thanks Meter: 30
 
More
Quote:
Originally Posted by zx2c4

Local network access is permitted by the default wg-quick(8) stuff on ordinary Linux. But it looks like there might be some special things needed with ndc on Android for pass through. I'll have to look into this. Thanks for the suggestion.

Thanks for the reply.
When it's already implemented, do we need to update our ROM or we can use only updated app?

Sent from my ONEPLUS A3003 using Tapatalk
29th November 2017, 01:09 PM |#22  
zx2c4's Avatar
OP Recognized Developer
Flag Paris
Thanks Meter: 799
 
Donate to Me
More
Quote:
Originally Posted by christantoan

When it's already implemented, do we need to update our ROM or we can use only updated app?

If it's implemented, we'll let you know at the right time the best way.
The Following 2 Users Say Thank You to zx2c4 For This Useful Post: [ View ]
29th November 2017, 02:26 PM |#23  
Senior Member
Thanks Meter: 27
 
More
Very excited for this. I just read about it & it seems like a Unicorn project. I wish you nothing but luck in your endeavors. Great work.
29th November 2017, 03:17 PM |#24  
nathanchance's Avatar
Recognized Developer / Recognized Contributor
Flag Mesa, AZ
Thanks Meter: 50,765
 
More
I just want to make sure I have a general idea of what I have to do to get this going on a stock ROM (Pixel 2 and Pixel 2 XL don't really have ROMs at the point and TWRP is wonky)...

1. Compile kernel with WireGuard drivers, which can be generated with the command
Code:
contrib/kernel-tree/create-patch.sh | patch -p1
within the WireGuard source.

2. Follow the README in the standalone folder within the android_kernel_wireguard source.

3. Use app for configuration.

Sounds simple but just want to make sure I'm not misreading something. Glad to see this growing, have always been interested in your work from the Linux kernel.
The Following User Says Thank You to nathanchance For This Useful Post: [ View ]
29th November 2017, 03:18 PM |#25  
Senior Member
Thanks Meter: 20
 
More
Quote:
Originally Posted by christantoan

Try running this script with "sh script-name.sh" (as root probably) a....

Thank you but I'm having some difficulty running it, what am I doing wrong? Navigated to download folder and tried different commands but only got this far.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20171129-161252.png
Views:	592
Size:	225.3 KB
ID:	4346714  
29th November 2017, 03:40 PM |#26  
zx2c4's Avatar
OP Recognized Developer
Flag Paris
Thanks Meter: 799
 
Donate to Me
More
Quote:
Originally Posted by nathanchance

I just want to make sure I have a general idea of what I have to do to get this going on a stock ROM (Pixel 2 and Pixel 2 XL don't really have ROMs at the point and TWRP is wonky)...

1. Compile kernel with WireGuard drivers, which can be generated with the command

Code:
contrib/kernel-tree/create-patch.sh | patch -p1
within the WireGuard source.

That works. You can also do the jerry-rig.sh script, giving it the path of your android kernel, in order to keep it sync'd up with the WireGuard repo.
The Following 3 Users Say Thank You to zx2c4 For This Useful Post: [ View ]
29th November 2017, 04:51 PM |#27  
zx2c4's Avatar
OP Recognized Developer
Flag Paris
Thanks Meter: 799
 
Donate to Me
More
Quote:
Originally Posted by andersjohansson81

Thank you but I'm having some difficulty running it, what am I doing wrong? Navigated to download folder and tried different commands but only got this far.

When you copy and paste random untested scripts from people off of an Internet forum without trying to understand it first, what do you expect? Anyway it's not your fault. The code posted in that post was bogus and never would have worked.

I suspect you don't actually know the script intends to do, but if you actually do want what he posted to work, here's a version that does the right thing:

1. Download onto your computer https://א.cc/iTJ52eTN to do-the-thing-from-the-random-forum-if-thats-what-you-actually-want-to-do.bash.
2. On your computer, run `$ bash do-the-thing-from-the-random-forum-if-thats-what-you-actually-want-to-do.bash`
3. Copy the folder it tells you to copy to your phone somewhere.
4. Import those files into the WireGuard app.
5. Don't ask this thread for more help. Go to #wireguard on Freenode instead.
The Following 2 Users Say Thank You to zx2c4 For This Useful Post: [ View ]
29th November 2017, 05:20 PM |#28  
frap129's Avatar
Recognized Developer
Thanks Meter: 4,138
 
Donate to Me
More
Here's a little condition I wrote to make sure that the kernel version is correct.
Code:
if [[ ("$(grep -m 1 VERSION $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" = "3" && "$(grep PATCHLEVEL -m 1 $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" -ge "10") || "$(grep -m 1 VERSION $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" > "3" ]];
Not sure if you want to use it, but it makes it easier for a rom for multiple devices to support it.
29th November 2017, 05:31 PM |#29  
zx2c4's Avatar
OP Recognized Developer
Flag Paris
Thanks Meter: 799
 
Donate to Me
More
Quote:
Originally Posted by frap129

Here's a little condition I wrote to make sure that the kernel version is correct.

Code:
if [[ ("$(grep -m 1 VERSION $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" = "3" && "$(grep PATCHLEVEL -m 1 $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" -ge "10") || "$(grep -m 1 VERSION $(TARGET_KERNEL_SOURCE)/Makefile |grep -o '[0-9]')" > "3" ]];
Not sure if you want to use it, but it makes it easier for a rom for multiple devices to support it.

Hey frap, thanks for that. I had started to write something like that too, but stopped because I was having trouble imagining the utility of it. WireGuard already has something inside the source of "#if version<3.10.0, #error "Your kernel be old!", #endif", so there will already be a build error. Is your suggestion simply only doing the patch conditionally, so that it's not built at all? With the goal of allowing people to indiscriminately add it to their manifests without having to worry? That's not such a bad idea, though I will need to figure out a way of making a loud and annoying warning in this case.
29th November 2017, 05:48 PM |#30  
frap129's Avatar
Recognized Developer
Thanks Meter: 4,138
 
Donate to Me
More
Quote:
Originally Posted by zx2c4

Here's a little condition I wrote to make sure that the kernel version is correct.


Hey frap, thanks for that. I had started to write something like that too, but stopped because I was having trouble imagining the utility of it. WireGuard already has something inside the source of "#if version<3.10.0, #error "Your kernel be old!", #endif", so there will already be a build error. Is your suggestion simply only doing the patch conditionally, so that it's not built at all? With the goal of allowing people to indiscriminately add it to their manifests without having to worry? That's not such a bad idea, though I will need to figure out a way of making a loud and annoying warning in this case.

Yep. We're trying to integrate WireGuard into CarbonROM and have it only build for compatible devices since we support a lot.
29th November 2017, 06:19 PM |#31  
zx2c4's Avatar
OP Recognized Developer
Flag Paris
Thanks Meter: 799
 
Donate to Me
More
Quote:
Originally Posted by frap129

Yep. We're trying to integrate WireGuard into CarbonROM and have it only build for compatible devices since we support a lot.

Fixed it for you: https://git.zx2c4.com/android_kernel...a1706ef1a50e40

`repo sync` will have these changes.
The Following User Says Thank You to zx2c4 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes