All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] lib6/in6_2: don't assume that machine has 'eth0' interface name
@ 2015-06-09 13:01 Alexey Kodanev
       [not found] ` <55805135.3040401@oracle.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2015-06-09 13:01 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

systemd can rename network interfaces. We should look at LHOST_IFACES
variable for pre-defined test interface names.

Signed-off-by: Alexey Kodanev <alexey.kodanev@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;
 }
-- 
1.7.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] lib6/in6_2: don't assume that machine has 'eth0' interface name
       [not found] ` <55805135.3040401@oracle.com>
@ 2015-06-16 17:08   ` Cyril Hrubis
  2015-06-16 17:29     ` Alexey Kodanev
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2015-06-16 17:08 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> Any objection to this version?

Looks good, acked.

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH v2] lib6/in6_2: don't assume that machine has 'eth0' interface name
  2015-06-16 17:08   ` Cyril Hrubis
@ 2015-06-16 17:29     ` Alexey Kodanev
  0 siblings, 0 replies; 3+ messages in thread
From: Alexey Kodanev @ 2015-06-16 17:29 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko


On 06/16/2015 08:08 PM, Cyril Hrubis wrote:
> Hi!
>> Any objection to this version?
> Looks good, acked.
>

Patch applied.

Thanks,
Alexey


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-16 17:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 13:01 [LTP] [PATCH v2] lib6/in6_2: don't assume that machine has 'eth0' interface name Alexey Kodanev
     [not found] ` <55805135.3040401@oracle.com>
2015-06-16 17:08   ` Cyril Hrubis
2015-06-16 17:29     ` Alexey Kodanev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.