multiple PPP sessions from within a C app? - PPP

This is a discussion on multiple PPP sessions from within a C app? - PPP ; Is there a reasonable way to open many ppp sessions from within a C/C++ program? The only thing I've seen in poking around for a while is to fork and exec pppd. I want to open hundreds to test in ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: multiple PPP sessions from within a C app?

  1. multiple PPP sessions from within a C app?

    Is there a reasonable way to open many ppp sessions from within a C/C++
    program? The only thing I've seen in poking around for a while is to
    fork and exec pppd. I want to open hundreds to test in a lab situation
    so that doesn't seem like a very efficient way to go about it.

    I thought there would be some way to set sessions, get a file descriptor
    for each, and be on my way with select() in a single process. But I did
    find a limit of one PPP per process in /usr/include/pppd/pppd.h, so
    maybe my question is, can I do it in user space instead of in the kernel?


    --
    Cheers,
    Rick

  2. Re: multiple PPP sessions from within a C app?

    Rick Johns writes:
    > Is there a reasonable way to open many ppp sessions from within a
    > C/C++ program? The only thing I've seen in poking around for a while
    > is to fork and exec pppd.


    Yes, that's exactly how you'd do it with the current pppd design.

    (Are you using any particular operating system? Pppd runs on quite a
    few, and the low-level details differ on each.)

    > I want to open hundreds to test in a lab
    > situation so that doesn't seem like a very efficient way to go about
    > it.


    Is the overhead of having hundreds of fork/exec calls noticable
    compared to the overhead of having hundreds of simultaneous PPP
    negotiations? It's not clear to me that it's worth optimizing this
    bit.

    Measuring where time is spent and determining what needs to be
    optimized probably ought to be the first step.

    > I thought there would be some way to set sessions, get a file
    > descriptor for each, and be on my way with select() in a single
    > process. But I did find a limit of one PPP per process in
    > /usr/include/pppd/pppd.h, so maybe my question is, can I do it in user
    > space instead of in the kernel?


    Do _what_ in user space?

    The current pppd design puts the data path in the kernel (the linkage
    between IP and PPP) and the negotiation in user space. On input, the
    platform-dependent PPP kernel bits detect network layer packets and
    direct them towards the IP stack, and send everything else up through
    a file descriptor opened by pppd.

    It's certainly possible to modify pppd such that a single process runs
    an arbtrary number of sessions. Quite a few have done this
    independently. The usual way this is done is to ditch the "unit"
    nonsense and use allocated state structures with pointers passed from
    main(). One interesting problem to deal with is the way options are
    parsed: many refer to static data, and you'll likely want to rewrite a
    lot of this.

    It's also possible to modify pppd so that you handle _all_ of PPP in
    user space, including the data path. You'll likely need a user-space
    implementation of TCP/IP as well. Such a thing would likely perform
    terribly, but could possibly be handy for testing purposes or some
    sort of simulation environment.

    Of course, in all of the above, you're on your own. The current code
    has a fairly simple one-process-is-one-link design, despite the
    occasional red herring suggesting otherwise.

    --
    James Carlson, KISS Network
    Sun Microsystems / 1 Network Drive 71.234W Vox +1 781 442 2084
    MS UBUR02-212 / Burlington MA 01803-2757 42.497N Fax +1 781 442 1677

  3. Re: multiple PPP sessions from within a C app?

    James Carlson wrote:
    > Rick Johns writes:
    >
    >>Is there a reasonable way to open many ppp sessions from within a
    >>C/C++ program? The only thing I've seen in poking around for a while
    >>is to fork and exec pppd.

    >
    >
    > Yes, that's exactly how you'd do it with the current pppd design.

    Right, thanks, it's been so long since I had to fork/exec anything I
    didn't realize that would be so trivial.

    (Sorry, I meant to reply right away and got caught up in what I was doing.)

    --
    Cheers,
    Rick

  4. Re: multiple PPP sessions from within a C app?

    Hi,

    Would appreciate if you can share your results.


  5. Re: multiple PPP sessions from within a C app?

    vanitha@agilis.st.com.sg wrote:
    > Hi,
    >
    > Would appreciate if you can share your results.
    >


    I'm not sure how helpful this is, but for my proof of concept I just
    used a script to set up some links and then started my test program. A
    coworker had set up 128 links in a separate test, no problem. It will
    be better to have the application manage the links but I won't get to
    that part for a while.

    --
    Cheers,
    Rick Johns

+ Reply to Thread