I am writing a kernel module that should receive messages from user space and send the response back through the socket.
When the program and the module are on the same computer, and I use IP 127.0.0.1 , everything works fine. But when I try this on different machines and use a real network IP address, something like 192.168.3.146 only works in one way.
I get a message from user space, but I cannot get it from the kernel. I use the sock_sendmsg function to send a message from the kernel and does not return any error. Also, I do not receive any messages from the firewall that something came from another machine, from the kernel module.
There were similar questions and examples here, but they were not useful enough to me, or the examples were used by an too old version of the kernel. For the skeleton, I used this option from UDP sockets: http://people.ee.ethz.ch/~arkeller/linux/multi/kernel_user_space_howto-3.html . Any help?
Kernel module code to send:
void send_data(unsigned char *data) { if(!IS_ERR_OR_NULL(data)) { int ret; mm_segment_t oldfs; struct msghdr message; struct iovec ioVector; struct sockaddr_in sendAddr; sendAddr.sin_family = AF_INET; sendAddr.sin_addr.s_addr = INADDR_ANY;
source share