Date: Wed, 21 Jul 1999 11:59:31 +0530 From: "Ratnakar Tiwari" <rhtiwari@cygsoft.com> To: <freebsd-bugs@FreeBSD.ORG> Subject: Uninitialized function pointer in Network Address Translation code Message-ID: <001101bed342$646fbfa0$3e01010a@ratnakar>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. ------=_NextPart_000_000E_01BED370.7DEC7940 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am trying to figure out how Network Address Translation works and I was going through the FreeBSD source code for it.This source code was downloaded from: ftp.FreeBSD.org/pub/FreeBSD/FreeBSD-stable/src/sys/netinet . In file ip_input.c on line 163 a pointer is declared as follows: ip_nat_t *ip_nat_ptr ; ip_nat_t is a function type defined in ip_fw.h as typedef int ip_nat_t __P((struct ip **, struct mbuf **, struct ifnet *, int));=20 __P is a macro defined in ip_compat.h The function pointer ip_nat_ptr is used on line 441 of ip_input.c as: if (ip_nat_ptr && !(*ip_nat_ptr)(&ip, &m, m->m_pkthdr.rcvif, IP_NAT_IN) =20 However I was unable to determine where this pointer is being initialized.=20 Could somebody please explain to me what exactly is going on in the = code? Thanks. Ratnakar ------=_NextPart_000_000E_01BED370.7DEC7940 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type> <META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#d0d0c8> <DIV><FONT color=3D#000000 size=3D2>Hi,<BR> I am trying to figure = out how=20 Network Address Translation works and I<BR>was going through the FreeBSD = source=20 code for it.This source code was<BR>downloaded=20 from:<BR> ftp.FreeBSD.org/pub/FreeBSD/FreeBSD-stable/src/sys/netinet= =20 .</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>In file ip_input.c on line 163 = a pointer=20 is declared as follows:<BR>ip_nat_t *ip_nat_ptr ;</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>ip_nat_t is a function type defined = in ip_fw.h=20 as</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>typedef int ip_nat_t __P((struct ip = **, struct=20 mbuf **, struct ifnet *,<BR>int)); <BR> __P is a macro defined in=20 ip_compat.h</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>The function pointer ip_nat_ptr is = used on line=20 441 of ip_input.c as:</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2> if (ip_nat_ptr &&=20 !(*ip_nat_ptr)(&ip, &m, m->m_pkthdr.rcvif,=20 IP_NAT_IN)<BR> <BR>However I was unable to determine where this = pointer is=20 being<BR>initialized. </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>Could somebody please explain to me = what exactly=20 is going on in the code?</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>Thanks.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2></FONT> </DIV> <DIV><FONT color=3D#000000 size=3D2>Ratnakar</FONT></DIV></BODY></HTML> ------=_NextPart_000_000E_01BED370.7DEC7940-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001101bed342$646fbfa0$3e01010a>