Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Harsh Shandilya <me@msfjarvis.dev>
To: Adam Irr <adam.irr@outlook.com>, Jason <Jason@zx2c4.com>
Cc: wireguard@lists.zx2c4.com
Subject: Re: [PATCH] wg-quick: Android: Use ip link to set MTU
Date: Mon, 04 Jan 2021 17:53:11 +0000	[thread overview]
Message-ID: <375e4f5117985cc3d71fbd786e5ab3f1@msfjarvis.dev> (raw)
In-Reply-To: <DM5PR0701MB3670A1B8ADEF9BC7C8E06FEE92D30@DM5PR0701MB3670.namprd07.prod.outlook.com>

Hey Adam,

On 2021-01-03 05:59, Adam Irr wrote:
> The ndc command used didn't work on my Nvidia Shield (rooted with a
> custom-built kernel). The ip link command does work. I have only
> tested this on an Nvidia Shield (Android TV - Version 9.0 Pie).
> 
> I couldn't find a lot of documentation on ndc so it's possible my
> device/kernel is misconfigured. If you suspect this is the case, let
> me know.

You couldn't find documentation because there isn't any, it's 
effectively "private API" and Google has broken it time and again. It is 
rather curious that you're running into this issue though, since we've 
had the NDC code in place since before Android 9 came out and went 
through breaking changes in every cycle without these specific 
invocations failing. The last ndc related problem we had was with the 
Android 11 release, where a similar fix[1] was implemented.

I've Cc'ed Jason for reviewing this change, but I'm decidedly curious as 
to why just the Nvidia SHIELD seems to need it.

> 
> Signed-off-by: Adam Irr <adam.irr@outlook.com>
> ---
>  src/wg-quick/android.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/wg-quick/android.c b/src/wg-quick/android.c
> index 326efa9..941c7b8 100644
> --- a/src/wg-quick/android.c
> +++ b/src/wg-quick/android.c
> @@ -995,7 +995,7 @@ static void set_mtu(const char *iface, unsigned int 
> mtu)
>         int endpoint_mtu, next_mtu;
> 
>         if (mtu) {
> -               cndc("interface setmtu %s %u", iface, mtu);
> +               cmd("ip link set dev %s mtu %d", iface, mtu);
>                 return;
>         }
> 
> @@ -1016,7 +1016,7 @@ static void set_mtu(const char *iface, unsigned 
> int mtu)
>                         endpoint_mtu = next_mtu;
>         }
> 
> -       cndc("interface setmtu %s %d", iface, endpoint_mtu - 80);
> +       cmd("ip link set dev %s mtu %d", iface, endpoint_mtu - 80);
>  }
> 
>  static void add_route(const char *iface, unsigned int netid, const 
> char *route)
> --
> 2.25.1

Cheers,
Harsh

1: 
https://git.zx2c4.com/wireguard-tools/commit/?id=9a0d65e2afbd6e418c883e0de8555b4fac29f1d5

  reply	other threads:[~2021-01-04 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  5:59 Adam Irr
2021-01-04 17:53 ` Harsh Shandilya [this message]
2021-01-05  5:50   ` Adam Irr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=375e4f5117985cc3d71fbd786e5ab3f1@msfjarvis.dev \
    --to=me@msfjarvis.dev \
    --cc=Jason@zx2c4.com \
    --cc=adam.irr@outlook.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).