Skip site navigation (1)Skip section navigation (2)
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

[-- Attachment #1 --]
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)); 
 __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)
 
However I was unable to determine where this pointer is being
initialized. 

Could somebody please explain to me what exactly is going on in the code?

Thanks.

Ratnakar

[-- Attachment #2 --]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY bgColor=#d0d0c8>
<DIV><FONT color=#000000 size=2>Hi,<BR>&nbsp; I am trying to figure out how 
Network Address Translation works and I<BR>was going through the FreeBSD source 
code for it.This source code was<BR>downloaded 
from:<BR>&nbsp;ftp.FreeBSD.org/pub/FreeBSD/FreeBSD-stable/src/sys/netinet 
.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>In file ip_input.c on line 163&nbsp; a pointer 
is declared as follows:<BR>ip_nat_t *ip_nat_ptr ;</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>ip_nat_t is a function type defined in ip_fw.h 
as</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>typedef int ip_nat_t __P((struct ip **, struct 
mbuf **, struct ifnet *,<BR>int)); <BR>&nbsp;__P is a macro defined in 
ip_compat.h</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>The function pointer ip_nat_ptr is used on line 
441 of ip_input.c as:</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>&nbsp;if (ip_nat_ptr &amp;&amp; 
!(*ip_nat_ptr)(&amp;ip, &amp;m, m-&gt;m_pkthdr.rcvif, 
IP_NAT_IN)<BR>&nbsp;<BR>However I was unable to determine where this pointer is 
being<BR>initialized. </FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Could somebody please explain to me what exactly 
is going on in the code?</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Thanks.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Ratnakar</FONT></DIV></BODY></HTML>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001101bed342$646fbfa0$3e01010a>