Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Apr 1998 00:20:59 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        current@FreeBSD.ORG
Subject:   BUG in getnetent(3) and family?
Message-ID:  <199804040020.RAA13459@usr06.primenet.com>

next in thread | raw e-mail | index | archive | help
I think there is a bug in getnetent(3) and family's representation
of the value of the n_net field.

Specifically, if I:


    struct netent       *nep;
    struct in_addr      in;

    while( ( nep = getnetent()) != NULL) {  

        printf( "n_name:       %s\n", nep->n_name);
	in.s_addr = htonl(nep->n_net);
        printf( "n_net:        %s\n", inet_ntoa(in));
    }

And /etc/networks contains:

your-net        127                             # your comment
your-netmask    255.255.255                     # subnet mask for your-net
subnet1         127.0.1         alias1          # comment 1
subnet2         127.0.2         alias2          # comment 2



The ouput I get is:

n_name:       your-net
n_net:        0.0.0.127
n_name:       your-netmask
n_net:        0.255.255.255
n_name:       subnet1
n_net:        0.127.0.1
n_name:       subnet2
n_net:        0.127.0.2


Pretty obviously, missing tuples aren't being expanded, per the RFC
and per the man page?!?


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804040020.RAA13459>