Bug 12729

Summary: Missing function pointer initialization in Network code
Product: Base System Reporter: rhtiwari <rhtiwari>
Component: kernAssignee: Nick Hibma <n_hibma>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 1.0-RELEASE   
Hardware: Any   
OS: Any   

Description rhtiwari 1999-07-21 07:20:00 UTC
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 you are declaring a pointer:
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
Comment 1 Garrett A. Wollman 1999-07-28 03:55:03 UTC
<<On Tue, 20 Jul 1999 23:19:49 -0700 (PDT), rhtiwari@cygsoft.com said:


> In file ip_input.c on line 163 you are declaring a pointer:
> ip_nat_t *ip_nat_ptr ;

> However I was unable to determine where this pointer is being
> initialized. 

Precisely there.  It is a declaration of a variable with static
lifetime.  Please read ISO 9899 (or at least K&R II).

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

Nothing.  This is not a bug, and should not have had a PR filed on it.

-GAWollman
Comment 2 Nick Hibma freebsd_committer freebsd_triage 1999-07-28 07:59:37 UTC
Responsible Changed
From-To: freebsd-bugs->n_hibma

remind me to close it in a wee while. 
Comment 3 Nick Hibma freebsd_committer freebsd_triage 1999-07-28 13:42:41 UTC
State Changed
From-To: open->closed

Not a bug and explanation has been given.