I still dont understand why you using SOCK_DGRAM in your second example.
It also looks like you are using the downloadable TDIMon, hence does not
show
other traces(ioctl) TDI_ASSOCIATE_ADDRESS etc… It is not the full picture
you are getting.
Also look at this, and other related stuff in the following link,
particularly the remark(s)
about dgram socket and recv()
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/win
sock/recv_2.asp
-pro
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of oyk
Sent: Wednesday, April 07, 2004 7:00 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] TDI UDP routine filter problem
Hi??Prokash Sinha
I filter the TDI_CONNECT.
I “connect” to 192.168.0.158, really I rediect it to 10.1.0.158 in
TDI_CONNECT.
The datum is transmitted to 10.1.0.158.
tcpdump info on the server box(10.1.1.218 is my xp box):
09:05:02.243056 10.1.1.218.1050 > 10.1.0.158.8888: udp 9
4500 0025 020d 0000 7f11 2342 0a01 01da
0a01 009e 041a 22b8 0011 16e6 6664 6173
6661 7361 0a00 0000 0000 0000 0000
09:05:02.243189 10.1.0.158.8888 > 10.1.1.218.1050: udp 9 (DF)
4500 0025 0000 4000 4011 244f 0a01 009e
0a01 01da 22b8 041a 0011 16e6 6664 6173
6661 7361 0a
I use TDIMon debug tool to view the TDI info.
First, I “connect” to 10.1.0.158 directly.
98 0.94397556 udpclient2.exe:2 82918EF8 IRP_MJ_CREATE UDP:0.0.0.0:0
SUCCESS Address Open
99 0.94898039 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 SUCCESS Error Event
100 0.94900162 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 SUCCESS Datagram Receive Event
101 0.94901643 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 SUCCESS ErrorEx Event
102 0.94903011 udpclient2.exe:2 82918EF8 TDI_QUERY_INFORMATION
UDP:0.0.0.0:3975 SUCCESS Query Address
103 0.94908152 udpclient2.exe:2 82918EF8 TDI_CONNECT UDP:0.0.0.0:3975
10.1.0.158:8888 SUCCESS
236 3.58057295 udpclient2.exe:2 82918EF8 TDI_SEND UDP:0.0.0.0:3975
10.1.0.158:8888 SUCCESS Length:14
237 3.58082354 udpclient2.exe:2 82918EF8 TDI_EVENT_RECEIVE_DATAGRAM
UDP:0.0.0.0:3975 10.1.0.158:8888 SUCCESS Bytes taken: 14 Flags:
305 4.62443243 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 10.1.0.158:8888 SUCCESS Datagram Receive Event: NULL
306 4.62446987 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 10.1.0.158:8888 SUCCESS ErrorEx Event: NULL
307 4.62448468 udpclient2.exe:2 82918EF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:3975 10.1.0.158:8888 SUCCESS Error Event: NULL
308 4.62482383 udpclient2.exe:2 82918EF8 IRP_MJ_CLEANUP UDP:0.0.00:3975
SUCCESS
309 4.62484366 udpclient2.exe:2 82918EF8 IRP_MJ_CLOSE UDP:0.0.0.0:3975
SUCCESS
Secondly, I “connect” to 10.1.0.158 by redirecting in my filter test driver.
82 2.96117356 udpclient2.exe:1 8192CAF8 IRP_MJ_CREATE UDP:0.0.0.0:0
SUCCESS Address Open
83 2.96649434 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 SUCCESS Error Event
84 2.96653541 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 SUCCESS Datagram Receive Event
85 2.96656000 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 SUCCESS ErrorEx Event
86 2.96658290 udpclient2.exe:1 8192CAF8 TDI_QUERY_INFORMATION
UDP:0.0.0.0:1306 SUCCESS Query Address
87 2.96664744 udpclient2.exe:1 8192CAF8 TDI_CONNECT UDP:0.0.0.0:1306
10.1.0.158:8888 SUCCESS
196 6.79524129 udpclient2.exe:1 8192CAF8 TDI_SEND UDP:0.0.0.0:1306
10.1.0.158:8888 SUCCESS Length:18
197 6.79560559 udpclient2.exe:1 8192CAF8 TDI_EVENT_RECEIVE_DATAGRAM
UDP:0.0.0.0:1306 10.1.0.158:8888 SUCCESS Bytes taken: 18 Flags:
305 10.82728615 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 10.1.0.158:8888 SUCCESS Datagram Receive Event: NULL
306 10.82734621 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 10.1.0.158:8888 SUCCESS ErrorEx Event: NULL
307 10.82737108 udpclient2.exe:1 8192CAF8 TDI_SET_EVENT_HANDLER
UDP:0.0.0.0:1306 10.1.0.158:8888 SUCCESS Error Event: NULL
308 10.82779459 udpclient2.exe:1 8192CAF8 IRP_MJ_CLEANUP
UDP:0.0.0.0:1306 SUCCESS
309 10.82785605 udpclient2.exe:1 8192CAF8 IRP_MJ_CLOSE UDP:0.0.0.0:1306
SUCCESS
I did not find any usefule info for me.
My updclient2 could send datum, but could not recieve datum. why?
The code of udpclient2 is very simple, just for testing, shown in the
fellow:
int _tmain(int argc, _TCHAR* argv)
{
SOCKET sockfd;
struct sockaddr_in servaddr;
char sendline[MAXLINE], recvline[MAXLINE + 1];
memset(&servaddr,0,sizeof(sockaddr_in));
memset(recvline,0,MAXLINE+1);
memset(sendline,0,MAXLINE+1);
WSAData wsaData;
if( WSAStartup(MAKEWORD(2,2), &wsaData) != 0 )
{
_tprintf(“start up error”);
exit(1);
}
servaddr.sin_family=AF_INET;
servaddr.sin_port = htons(SERV_PORT);
servaddr.sin_addr.S_un.S_addr = inet_addr(argv[1]);
sockfd=socket(AF_INET, SOCK_DGRAM, 0);
int ret=0;
int error=0;
ret = connect(sockfd,(LPSOCKADDR)&servaddr,sizeof(servaddr));
if(ret == SOCKET_ERROR)
{
_tprintf(“Connect error:%d\n”,(error = WSAGetLastError()));
exit(1);
}
while(fgets(sendline, MAXLINE, stdin) != NULL)
{
ret = send(sockfd,sendline,strlen(sendline),0);
if(ret!=strlen(sendline))
{
_tprintf(“send error:%d expected;%d send”,strlen(sendline),ret);
exit(1);
}
ret = recv(sockfd, recvline, MAXLINE,0);
if(ret ==0)
{
_tprintf(“recv error:%d expected;%d send”,strlen(recvline),ret);
exit(1);
}
fputs(recvline, stdout);
memset(recvline,0,MAXLINE+1);
memset(sendline,0,MAXLINE+1);
}
closesocket(sockfd);
WSACleanup();
return 0;
}
Best Regards
Ouyang Kai
May be you should filter the TDI_SEND !. How you creating those socket, and
remember connect() is for Stream socket.
-pro
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of oyk
Sent: Wednesday, April 07, 2004 4:18 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] TDI UDP routine filter problem
Hi??all
I do the UDP filter test. Client <—> Server.
when my udp client code shows as the fellow:
socket();
while(1)
{
sendto();
recvfrom();
}
…
I sendto the “10.1.0.158”(my udp server ip), it works fine.
I sendto the “192.168.0.158”(my udp server ip), and redirect the
destination
in my TDI filter driver(TDI_SEND_DATAGRAM), it works fine.
when my udp client code shows as the fellow:
socket();
connect();
while(1)
{
send();
recv();
}
…
If I “connect” to the “10.1.0.158”(i know it does not really do connect to
the server), it works fine.
If I “connect” to the “192.168.0.158”, I want redirect the destination in
my
TDI filter driver,
I do not know how to deal with this case.
Please Help.
Thanks.
Best Regards
Ouyang Kai
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@garlic.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@wtwh.com.cn
To unsubscribe send a blank email to xxxxx@lists.osr.com
.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@garlic.com
To unsubscribe send a blank email to xxxxx@lists.osr.com