*BSD News Article 18689


Return to BSD News archive

Xref: sserve comp.unix.bsd:12305 comp.bugs.4bsd:1993
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!aardvark.ucs.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!ogicse!uwm.edu!cs.utexas.edu!uunet!emba-news.uvm.edu!trantor.emba.uvm.edu!wollman
Newsgroups: comp.unix.bsd,comp.bugs.4bsd
Subject: [Net/2] Simple patch to sbin/route/route.c for inet_aton()
Message-ID: <1993Jul21.025357.3776@emba.uvm.edu>
From: wollman@trantor.emba.uvm.edu (Garrett Wollman)
Date: 21 Jul 93 02:53:57 GMT
Sender: news@emba.uvm.edu
Organization: University of Vermont, EMBA Computer Facility
Article-I.D.: emba.1993Jul21.025357.3776
Lines: 41

The Net/2 route.c uses inet_addr() instead of inet_aton().  This makes
it impossible to specify an IP address of 255.255.255.255 to the route
program.  This came up when I was trying to figure out how cloning
worked, and was wondering why

$ route change UVM-NET -cloning -genmask 255.255.255.255

wasn't working, but

$ route change UVM-NET -cloning -genmask 255.255.255.0

did indeed have the expected effect.  This patch fixes this.  (Now if
only the Net/2 TCP would take advantage of it...)

*** route.c~	Fri Feb  7 20:36:47 1992
--- route.c	Tue Jul 20 22:40:06 1993
***************
*** 810,816 ****
  	if (hpp == NULL)
  		hpp = &hp;
  	*hpp = NULL;
! 	if (((val = inet_addr(s)) != -1) &&
  	    (which != RTA_DST || forcenet == 0)) {
  		su->sin.sin_addr.s_addr = val;
  		if (inet_lnaof(su->sin.sin_addr) != INADDR_ANY)
--- 810,816 ----
  	if (hpp == NULL)
  		hpp = &hp;
  	*hpp = NULL;
! 	if ((inet_aton(s, &val) != 0) &&
  	    (which != RTA_DST || forcenet == 0)) {
  		su->sin.sin_addr.s_addr = val;
  		if (inet_lnaof(su->sin.sin_addr) != INADDR_ANY)

-GAWollman

-- 
Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
wollman@emba.uvm.edu | Shashish is the bonding of hearts in spite of distance.
uvm-gen!wollman      | It is a bond more powerful than absence.  We like people
UVM disagrees.       | who like Shashish.  - Claude McKenzie + Florent Vollant