detecting tcp/udp socket bind in kernel module

Discussion in 'Linux Networking' started by hari_kannan, Mar 21, 2007.

  1. hari_kannan

    hari_kannan Guest


    I want to detect tcp/udp socket binds programmatically i.e. I want to
    write a module which will "know" whenever any tcp/ip application does
    a tcp or udp socket bind. In SLES9/RHEL3.X versions, we used to trap
    the "bind" function in inet_dgram_ops and tcpsniff_bind, but in SLES10/
    RHEL4.x versions, those variables have become "const" in af_inet.c

    What we did before was

    udp.save_bind = inet_dgram_ops.bind;
    udp.save_release = inet_dgram_ops.release;
    inet_dgram_ops.bind = udpsniff_bind;
    inet_dgram_ops.release = udpsniff_release;


    tcp.save_bind = inet_stream_ops.bind;
    tcp.save_release = inet_stream_ops.release;
    inet_stream_ops.bind = tcpsniff_bind;
    inet_stream_ops.release = tcpsniff_release

    I cant do that anymore because inet_stream_ops and inet_dgram_ops are
    const in SLES10.

    Any ideas?

    Thanks a lot!
    hari_kannan, Mar 21, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.