Subject: kern/5951: ip_input.c: diagnostig printf in confusing format
To: None <gnats-bugs@gnats.netbsd.org>
From: Heiko W.Rupp <hwr@pilhuhn.de>
List: netbsd-bugs
Date: 08/11/1998 15:00:14
>Number:         5951
>Category:       kern
>Synopsis:       ip_input.c: diagnostig printf in confusing format
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 11 06:05:01 1998
>Last-Modified:
>Originator:     Heiko W.Rupp
>Organization:
	
>Release:        NetBSD-1.3.2
>Environment:
	
System: NetBSD snert 1.3.2 NetBSD 1.3.2 (SNERT) #1: Tue Jun 2 18:14:44 MEST 1998 hwr@snert:/homes/hwr/sys/arch/i386/compile/SNERT i386


>Description:

#define DIAGNOSTIC and and in ip_input.c ipprintfs=1

and then watch syslog for forward addresses.

Another unfine thing is, that addresses are in network byte order, not
host byte order.

Possibly this occours at other places too.

>How-To-Repeat:

look at ip_input.:

void
ip_forward(m, srcrt)

#ifdef DIAGNOSTIC
        if (ipprintfs)
                printf("forward: src %x dst %x ttl %x\n",
                    ip->ip_src.s_addr, ip->ip_dst.s_addr, ip->ip_ttl);
#endif

>Fix:

e.g.:

#ifdef DIAGNOSTIC
        if (ipprintfs)
                printf("forward: src %2.2x dst %2.2x ttl %x\n",
                    ntohl(ip->ip_src.s_addr), 
                    ntohl(ip->ip_dst.s_addr), ip->ip_ttl);
#endif

>Audit-Trail:
>Unformatted: