Skip to contentSkip to conversation

non-root, non-real network manipulation for netconf testing

DISCUSSION martin f krafft 3 participants 6 messages Jun 3, 2008 – Jun 4, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Dear networking wizards,

This is a bit of a self-reflexive mail, but I hope some of you might have some input...

In writing netconf[0], we are having a bit of a problem with the test suite, since many of netconf's operations require root rights (e.g. interface manipulation with /bin/ip). In addition, a test suite manipulating the network configuration of the running machine is not really something I feel comfortable with.

0. http://netconf.alioth.debian.org

So I am trying to come up with alternative plans, of which there are three:

1. do not fail tests that need root rights when run as non-root
2. set up a VDE network (which still requires root rights)
3. write a mock /bin/ip which pretends to be doing what it'd be doing

None of these three is satisfactory. (1) provides incomplete test coverage unless run by root, which is not going to be done very often, (2) can be combined with (1) but still puts the host machine in danger of losing connectivity, and (3) just sounds terrible, especially when other stuff, like dhclient or wpa_supplicant come into play.

Of course, I am asking a bit much, but maybe you guys have some input that could help us move along?

What I really want is some context handler that can emulate a complete network and process stack for my test scripts, let a normal user modify anything they want, but not touch anything on the actual system. Sort of like database transactions. I think I may be out of luck though, no?

Signature · 7 lines
martin | http://madduck.net/ | http://two.sentenc.es/
 
"you don't sew with a fork, so I see no reason
 to eat with knitting needles."
                               -- miss piggy, on eating chinese food
 
spamtraps: [email protected]
#1 lore raw
Quoted 11 lines · martin f krafft

Dear networking wizards,

This is a bit of a self-reflexive mail, but I hope some of you might have some input...

In writing netconf[0], we are having a bit of a problem with the test suite, since many of netconf's operations require root rights (e.g. interface manipulation with /bin/ip). In addition, a test suite manipulating the network configuration of the running machine is not really something I feel comfortable with.

Quoted 8 lines

0. http://netconf.alioth.debian.org

So I am trying to come up with alternative plans, of which there are three:

1. do not fail tests that need root rights when run as non-root
2. set up a VDE network (which still requires root rights)
3. write a mock /bin/ip which pretends to be doing what it'd be doing

[...]

Have you considering running the tests in User-Mode Linux or some other kind of virtualised environment?

Ben.

Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
#2 lore raw

also sprach Ben Hutchings <[email protected]> [2008.06.03.1205 +0200]:

Quoted 2 lines

Have you considering running the tests in User-Mode Linux or some other kind of virtualised environment?

Yes, but that would require root rights as well, and quite a lot of setup, making it pretty unlikely that passerby developers would run tests, or allowing me to run the tests automatically on build daemons.

Signature · 7 lines
martin | http://madduck.net/ | http://two.sentenc.es/
 
"work consists of whatever a body is obliged to do.
 play consists of whatever a body is not obliged to do."
                                                         -- mark twain
 
spamtraps: [email protected]
#3 lore raw
Quoted 8 lines · martin f krafft

also sprach Ben Hutchings <[email protected]> [2008.06.03.1205 +0200]:

Quoted 2 lines

Have you considering running the tests in User-Mode Linux or some other kind of virtualised environment?

Yes, but that would require root rights as well, and quite a lot of setup, making it pretty unlikely that passerby developers would run tests, or allowing me to run the tests automatically on build daemons.

I don't believe that's the case for UML.

Ben.

Signature · 2 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
#5 lore raw
In reply to martin f krafft

Hi,

Quoted 2 lines · martin f krafft

Of course, I am asking a bit much, but maybe you guys have some input that could help us move along?

The best way would be to use the Hurd, and write a network device emulator (which can be modified without messing up actual network devices). But I suppose that's not an option. ;-)

As a second option, I'd go for qemu. It can be run as non-root and communicate about its test results over the serial port (connected to stdout). However, building a qemu image takes a long time, and I think you still need root for that.

Quoted 4 lines

What I really want is some context handler that can emulate a complete network and process stack for my test scripts, let a normal user modify anything they want, but not touch anything on the actual system.

Qemu does all that, it emulates a whole computer with it. :-)

Quoted 8 lines · martin f krafft

also sprach Ben Hutchings <[email protected]> [2008.06.03.1205 +0200]:

Quoted 2 lines

Have you considering running the tests in User-Mode Linux or some other kind of virtualised environment?

Yes, but that would require root rights as well, and quite a lot of setup, making it pretty unlikely that passerby developers would run tests, or allowing me to run the tests automatically on build daemons.

You can do all the setup automatically, so passerby developers don't need to know how to do it. However, the root rights (or, in case of qemu, the heavy setup process) does probably make it impractical to do it on a buildd, for example.

An option would be to create a dummy network device of the type I described for the Hurd, but for Linux, and package that in a separate package. Netconf can build-depend on it, so it is installed (and can make sure it is available for normal users).

However, I don't think Linux allows network interfaces to tell that normal users may modify them...

Thanks,
Bas

Signature · 6 lines
I encourage people to send encrypted e-mail (see http://www.gnupg.org).
If you have problems reading my e-mail, use a better reader.
Please send the central message of e-mails as plain text
   in the message body, not as HTML and definitely not as MS Word.
Please do not use the MS Word format for attachments either.
For more information, see http://pcbcn10.phys.rug.nl/e-mail.html
#4 lore raw
In reply to Ben Hutchings

also sprach Ben Hutchings <[email protected]> [2008.06.03.1247 +0200]:

Quoted 1 line

I don't believe that's the case for UML.

You're right. I spent some time with UML yesterday and got it to the point where it can run an command in a UML and report back the status code without requiring any setup or root rights. If you're interested:

http://git.debian.org/?p=netconf/netconf.git;a=tree;f=uml;hb=umltest

Now I need to figure out how to set up uml_switch as a user such that I can have two or three interfaces within the UML on the same network segment.

Right now, my problem is that if eth0-2 have 1.2.3.1-3 assigned to them, pinging 1.2.3.2 from 1.2.3.1 will make Linux route the packets via loopback. I need to figure out how to make them be put on the wire (which is uml_switch in this case).

Signature · 8 lines
martin | http://madduck.net/ | http://two.sentenc.es/
 
"whale feces or working at microsoft? i would probably be the whale
 feces researcher. salt air and whale flatulence; what
 could go wrong?"
             -- michael moyer, executive editor of _popular science_
 
spamtraps: [email protected]