detecting tcp/udp socket bind in kernel module

detecting tcp/udp socket bind in kernel module

Post by hari_kan.. » Fri, 23 Mar 2007 03:34:57


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!


1. TCP socket to UDP socket?

Hi -
  This may be a dumb question, but can you create a server TCP socket
  and connect to it by opening a client UDP socket?  I can't think of a
  reason why I would ever design a (simple) program to do this, but if
  you were communicating across different networks that had different
  protocols defined, isn't the job of a protocal layer to examine the
  incoming packet and send it to the approriate destination?  Am I on
  the right page here, or am I comparing apples and oranges?
I'm just trying to get a grasp on these network layers and how they
function, and trying to figure out the most efficent way to use them in
standard socketing.

thanks in advance-

Posted via

2. Help!!~~My Modem doesn't Work!!~

3. udp socket in a kernel module?

4. Traffic shapping

5. ipchains/TCP/UDP, Why should I open UDP ports so that my TCP ports can work?

6. gcc

7. How to detect TCP sequence number wrap around in a netfilter kernel module

8. Working with floating point numbers

9. Binding a DGRAM (UDP) socket?

10. Increase default upper bound of socket buffer size(UDP)

11. Binding on UDP Socket [Maybe OT]

12. bind()/connect() to port 0 question for tcp/udp