Re: Redirecting Sockets using NKE
Re: Redirecting Sockets using NKE
- Subject: Re: Redirecting Sockets using NKE
- From: Matt Jaffa <email@hidden>
- Date: Mon, 7 Jun 2004 12:47:44 -0600
hmmmm,
looking more into it, it seems that I need to manipulate the pcb in
the socket?
does that seem correct?
Matt
On Jun 7, 2004, at 11:08 AM, Matt Jaffa wrote:
yeah I realize that now,
If the application detects that I closed the socket it is going to
just quit trying.
but then that socket will connect to my userland daemon and spin on
recv but the app that called the GET won't be sending anything because
the connection was closed at an earlier time.
So how would I go about trying the first option, modifying the
connection without the App that is sending the GET request to not
know?
Matt
On Jun 7, 2004, at 8:53 AM, Joshua Graessley wrote:
Are you closing the socket that was passed in to your filter function
and creating a new one? That won't work. The socket is associated with
a file descriptor. There are two things you can do here. Either try
and
modify the original connect so the socket really gets connected to
your
daemon and patch everything else so the client process will never know
or create another socket that you send data to your daemon through and
then inject the response in to the original socket.
-josh
On Jun 7, 2004, at 12:21 AM, Matt Jaffa wrote:
Hi,
I have successfully created a NKE and I am particularily interested
in
the send function that I am using.
In the send function I detect if the outgoing message is a GET
request
if so I do this:
if( is a GET request) {
struct sockaddr_in server; /* the information structure for the
server
(to be filled out) */
bzero(&server, sizeof(struct sockaddr_in));
struct in_addr s_addr;
s_addr.s_addr = 2130706433;
server.sin_len = sizeof(server);
memcpy(&server.sin_addr, &s_addr, sizeof(struct in_addr));
server.sin_family = AF_INET; // Set the server's family
server.sin_port = htons((unsigned short) 48080); /* Set the port to
connect to... */
int threeerror = sodisconnect(so);
printf("threeerror: %d\n", threeerror);
int shuterror = soshutdown(so,2);
printf("shuterror: %d\n", shuterror);
//int mosterror = soclose(so);
//printf("mosterror: %d\n", mosterror);
int testerror = socreate(AF_INET, &so,SOCK_STREAM,0);
printf("testerror: %d\n", testerror);
int theerrors = soconnect(so, (struct sockaddr*)&server);
printf("theerrors: %d\n", theerrors);
}
And then I have a daemon that is listening on 127.0.0.1 with port
48080. In the daemon it successfully gets past the accept, but spins
on recv(....,...,....,....) forever. So I am assuming that in the
Kernel after I have redirected the socket to my daemon, and then when
the send function returns it sends that GET request instead to my
daemon, where I can look at the information.
But in my daemon the accept works, but it doesn't get past
recv(,,,,,,,,,);
What to do?
thanks,
Matt
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.