netgraph(4) divert(4) to UDP Tunnel

From: Crist J. Clark (cristjc_at_comcast.net)
Date: 11/13/03

  • Next message: Crist J. Clark: "Re: IPSec VPN & NATD (problem with alias_address vs redirect_address)"
    Date: Thu, 13 Nov 2003 12:24:35 -0800
    To: net@freebsd.org
    
    

    I'm trying to play around with netgraph(4) for the first time and
    there seem to be some aspects of it that haven't "clicked" in my head
    just yet.

    What I want to do seems like it should be pretty easy. I want to
    send some packets through a UDP tunnel. There is an
    /usr/share/examples/netgraph/udp.tunnel file that is close to what I
    want, but not quite. I want to send packets that have been divert(4)ed
    to the tunnel.

    I can make my two ng_ksocket(8) nodes via the ngctl(8) interface,

     + mkpeer ksocket d0 inet/dgram/udp
     + name d0 udptun
     + msg d0 bind inet/192.168.64.70:10000
     + msg d0 connect inet/192.168.64.50:10000
     + mkpeer ksocket d1 inet/raw/divert
     + name d1 divtun
     + msg d1 bind inet/0.0.0.0:8668

    But how do I then connect the two of them up? I assume that I use
    'connect' within ngctl(8), but I haven't figured out what the
    arguments need to be with the documentation and examples I've found.

    The other thing I suspect I should be doing, is actually running the
    'mkpeer' through the first node I create in ngctl(8), but I can't seem
    to get that to work,

     + mkpeer ksocket d0 inet/dgram/udp
     + name d0 udptun
     + msg d0 bind inet/192.168.64.70:10000
     + msg d0 connect inet/192.168.64.50:10000
     + mkpeer d0 ksocket d1 inet/raw/divert
     ngctl: send msg: Socket is already connected

    I think it is actually complaining about the hook between my ngctl
    node and the udptun node and not the creation of the divert socket?

    Basically, I think my conceptual problem is with the fact that you
    start with the ngctl(8) node in the middle of everything. How do I
    create my new nodes and get the ngctl(8) node out of the middle?

    -- 
    Crist J. Clark                     |     cjclark@alum.mit.edu
                                       |     cjclark@jhu.edu
    http://people.freebsd.org/~cjc/    |     cjc@freebsd.org
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Crist J. Clark: "Re: IPSec VPN & NATD (problem with alias_address vs redirect_address)"

    Relevant Pages

    • Re: memory allocation problems
      ... This is probably why the function performs well the first time you ... > void WriteMessage(FILE* fp, const char* msg) ... > strcpy(buffer, curtime); ... >>> writing to a file in the funciton and then I delete buffer memory using ...
      (microsoft.public.vc.language)
    • Have you seen this error msg before?
      ... I use my laptop alone and have done for 2 years. ... Today I got this msg for ... the first time: ... Your system policy has denied access to the requested URL. ...
      (microsoft.public.windowsxp.general)
    • Can anyone help with systems policy, please?
      ... I use my laptop alone and have done for 2 years. ... Today I got this msg for ... the first time: ... Your system policy has denied access to the requested URL. ...
      (microsoft.public.windowsxp.general)
    • Re: memory allocation problems
      ... void WriteMessage(FILE* fp, const char* msg) ... >> Unhandled exception at 0x77f75a58 in FileIOTest.exe: ... >> The first time I call the function, all is well but subsequent times it ... >> writing to a file in the funciton and then I delete buffer memory using ...
      (microsoft.public.vc.language)
    • Re: memory allocation problems
      ... > void WriteMessage(FILE* fp, const char* msg) ... > strcpy(buffer, curtime); ... >>> The first time I call the function, all is well but subsequent times it ... >>> writing to a file in the funciton and then I delete buffer memory using ...
      (microsoft.public.vc.language)