From nobody@FreeBSD.ORG Tue Jul 20 23:19:49 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 1075115140; Tue, 20 Jul 1999 23:19:49 -0700 (PDT)
Message-Id: <19990721061949.1075115140@hub.freebsd.org>
Date: Tue, 20 Jul 1999 23:19:49 -0700 (PDT)
From: rhtiwari@cygsoft.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: Missing function pointer initialization in Network code
X-Send-Pr-Version: www-1.0

>Number:         12729
>Category:       kern
>Synopsis:       Missing function pointer initialization in Network code
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 20 23:20:00 PDT 1999
>Closed-Date:    Wed Jul 28 05:42:41 PDT 1999
>Last-Modified:  Wed Jul 28 05:43:17 PDT 1999
>Originator:     Ratnakar Tiwari
>Release:        
>Organization:
Cygnet Software Pvt. Ltd.
>Environment:
>Description:
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
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: rhtiwari@cygsoft.com
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: kern/12729: Missing function pointer initialization in Network code
Date: Tue, 27 Jul 1999 22:55:03 -0400 (EDT)

 <<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
 
 
Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Tue Jul 27 23:59:37 PDT 1999 
Responsible-Changed-Why:  
remind me to close it in a wee while. 
State-Changed-From-To: open->closed 
State-Changed-By: n_hibma 
State-Changed-When: Wed Jul 28 05:42:41 PDT 1999 
State-Changed-Why:  
Not a bug and explanation has been given. 
>Unformatted:
