Hi Cyril,
On 06/09/2015 04:01 PM, Alexey Kodanev wrote:
> systemd can rename network interfaces. We should look at LHOST_IFACES
> variable for pre-defined test interface names.
>
> Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com>
> ---
> v2: use sscanf() instead of strchr()
>      allocate buffer on the stack
>
>   testcases/network/lib6/in6_02.c |   19 +++++++++++++++++++
>   1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/network/lib6/in6_02.c b/testcases/network/lib6/in6_02.c
> index fea1827..7cb3626 100644
> --- a/testcases/network/lib6/in6_02.c
> +++ b/testcases/network/lib6/in6_02.c
> @@ -255,4 +255,23 @@ void initest(void)
>   void setup(void)
>   {
>       TEST_PAUSE;
> +
> +     tst_resm(TINFO, "get interface name from LHOST_IFACES var");
> +
> +     char *ifnames = getenv("LHOST_IFACES");
> +
> +     if (!ifnames) {
> +             tst_resm(TWARN, "LHOST_IFACES not defined, default to eth0");
> +             return;
> +     }
> +
> +     static char name[256];
> +
> +     sscanf(ifnames, "%255s", name);
> +
> +     if (!strcmp(name, n2i[1].name))
> +             return;
> +
> +     tst_resm(TINFO, "change default 'eth0' name to '%s'", name);
> +     n2i[1].name = name;
>   }

Any objection to this version?

Thanks,
Alexey


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to