Date: Mon, 13 Aug 2001 12:51:43 -0400 (EDT) From: Joe Clarke <marcus@marcuscom.com> To: <freebsd-hackers@freebsd.org> Subject: Writing a packet alias translator, need help Message-ID: <20010813124054.F13703-100000@shumai.marcuscom.com>
next in thread | raw e-mail | index | archive | help
I'm trying to write a packet alias translator for a protocol that uses TCP to setup a UDP streaming session (much like the smedia driver that's already there). I'm having a problem getting the translated port to mesh with the actual port. Here's what I've done: /* msg is a TCP setup packet struct msg { u_int32_t ipAddr; u_int32_t portNumber; }; */ null_addr.s_addr = 0; msg->ipAddr = (u_int32_t)GetAliasAddress(link).s_addr; my_link = FindUdpTcpOut(pip->ip_src, null_addr, msg->portNumber, 0, IPPROTO_UDP, 1); msg->portNumber = (u_int32_t)GetAliasPort(my_link); What happens is that the IP address gets handled correctly, but not the port number. The translation occurs in the packet, but it doesn't get translated to the correct number. For example, the actual port being used is UDP 16704, but the translation puts 50535 in the packet. I guess my question is how can I put the correct port number in the TCP setup packet? How can I then use this port number in the upcoming UDP stream? I've never written a NAT translator before, so I'm not sure if FindUdpTcpOut() does what I think. any help would be appreciated. Joe Clarke To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010813124054.F13703-100000>