Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to simulator arguments for readability #85

Merged
merged 2 commits into from
Jul 14, 2015
Merged

Conversation

drzaeus77
Copy link
Collaborator

  • Let one argument be optional
  • Disable ipv6 for whole namespace once
  • Python 2/3 compatibility fix

Signed-off-by: Brenden Blanco [email protected]

* Let one argument be optional
* Disable ipv6 for whole namespace once
* Python 2/3 compatibility fix

Signed-off-by: Brenden Blanco <[email protected]>
cmd = ["sysctl", "-q", "-w", "net.ipv6.conf.default.disable_ipv6=1"]
nsp = NSPopen(ns_ipdb.nl.netns, cmd)
nsp.wait(); nsp.release()
ns_ipdb.interfaces.lo.up().commit()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To disable ipv6, do we need to disable both veth end ifc, or just the ifc inside netns?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't all of the ifcs end up inside a netns?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out_ifc is not in the namespace.

On Mon, Jul 13, 2015 at 9:57 PM, Brenden Blanco [email protected]
wrote:

In examples/simulation.py
#85 (comment):

     if name in self.ipdbs:
         ns_ipdb = self.ipdbs[name]
     else:
         ns_ipdb = IPDB(nl=NetNS(name))
  •        if disable_ipv6:
    
  •            cmd = ["sysctl", "-q", "-w", "net.ipv6.conf.default.disable_ipv6=1"]
    
  •            nsp = NSPopen(ns_ipdb.nl.netns, cmd)
    
  •            nsp.wait(); nsp.release()
    
  •        ns_ipdb.interfaces.lo.up().commit()
    

Don't all of the ifcs end up inside a netns?


Reply to this email directly or view it on GitHub
https://github.com/iovisor/bcc/pull/85/files#r34537240.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried the patch (git checkout bblanco_dev) and tried on my local box:

9: F
9: ======================================================================
9: FAIL: test_brb2 (main.TestBPFSocket)
9: ----------------------------------------------------------------------
9: Traceback (most recent call last):
9: File "/home/plumgrid/iovisor/bcc/tests/cc/test_brb2.py", line 165, in
test_brb2
9: self.assertEqual(self.pem_stats[c_uint(0)].value, 12)
9: AssertionError: 23L != 12

So it does seem we also need to disable ipv6 for outer ifc as well.

On Mon, Jul 13, 2015 at 9:57 PM, Brenden Blanco [email protected]
wrote:

In examples/simulation.py
#85 (comment):

     if name in self.ipdbs:
         ns_ipdb = self.ipdbs[name]
     else:
         ns_ipdb = IPDB(nl=NetNS(name))
  •        if disable_ipv6:
    
  •            cmd = ["sysctl", "-q", "-w", "net.ipv6.conf.default.disable_ipv6=1"]
    
  •            nsp = NSPopen(ns_ipdb.nl.netns, cmd)
    
  •            nsp.wait(); nsp.release()
    
  •        ns_ipdb.interfaces.lo.up().commit()
    

Don't all of the ifcs end up inside a netns?


Reply to this email directly or view it on GitHub
https://github.com/iovisor/bcc/pull/85/files#r34537240.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. You are using a bridge to link the two veth pairs together. It could be done by inserting one end of a veth pair into the other namespace directly, such that neither of them show up in the abstract namespace. In fact, the support for this is exactly what this function is supposed to achieve, but in a different set of code example (in a private codebase, so you don't see it here). I will amend the patch to use that approach, and eliminate the extra bridges.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be fine too. Please do add some comments in simulation.py though
to warn that if users do have one end of veth not in the namespace, they
will be responsible to disable ipv6 if it is desirable to them.

On Mon, Jul 13, 2015 at 10:14 PM, Brenden Blanco [email protected]
wrote:

In examples/simulation.py
#85 (comment):

     if name in self.ipdbs:
         ns_ipdb = self.ipdbs[name]
     else:
         ns_ipdb = IPDB(nl=NetNS(name))
  •        if disable_ipv6:
    
  •            cmd = ["sysctl", "-q", "-w", "net.ipv6.conf.default.disable_ipv6=1"]
    
  •            nsp = NSPopen(ns_ipdb.nl.netns, cmd)
    
  •            nsp.wait(); nsp.release()
    
  •        ns_ipdb.interfaces.lo.up().commit()
    

I see. You are using a bridge to link the two veth pairs together. It
could be done by inserting one end of a veth pair into the other namespace
directly, such that neither of them show up in the abstract namespace. In
fact, the support for this is exactly what this function is supposed to
achieve, but in a different set of code example (in a private codebase, so
you don't see it here). I will amend the patch to use that approach, and
eliminate the extra bridges.


Reply to this email directly or view it on GitHub
https://github.com/iovisor/bcc/pull/85/files#r34537754.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back to the original, since I realized that you actually wanted the outer bridges to exist as part of the test scenario.

yonghong-song added a commit that referenced this pull request Jul 14, 2015
Change to simulator arguments for readability
@yonghong-song yonghong-song merged commit 8ebd277 into master Jul 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants