projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
date and time created 83/01/11 14:35:34 by sam
[unix-history]
/
usr
/
src
/
sbin
/
routed
/
af.c
diff --git
a/usr/src/sbin/routed/af.c
b/usr/src/sbin/routed/af.c
index
13731cf
..
bbddfe0
100644
(file)
--- a/
usr/src/sbin/routed/af.c
+++ b/
usr/src/sbin/routed/af.c
@@
-1,16
+1,8
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)af.c 4.
5
%G%";
+static char sccsid[] = "@(#)af.c 4.
9
%G%";
#endif
#endif
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/in.h>
#include "router.h"
#include "router.h"
-#include "rip.h"
-
-extern char packet[MAXPACKETSIZE], *sys_errlist[];
-extern int trace, errno;
-#define tprintf if (trace) printf
/*
* Address family support routines
/*
* Address family support routines
@@
-38,7
+30,7
@@
inet_hash(sin, hp)
struct afhash *hp;
{
struct afhash *hp;
{
- hp->afh_nethash =
sin->sin_addr.s_net
;
+ hp->afh_nethash =
inet_netof(sin->sin_addr)
;
hp->afh_hosthash = sin->sin_addr.s_addr;
#if vax || pdp11
hp->afh_hosthash = ntohl(hp->afh_hosthash);
hp->afh_hosthash = sin->sin_addr.s_addr;
#if vax || pdp11
hp->afh_hosthash = ntohl(hp->afh_hosthash);
@@
-50,35
+42,33
@@
inet_netmatch(sin1, sin2)
struct sockaddr_in *sin1, *sin2;
{
struct sockaddr_in *sin1, *sin2;
{
- return (
sin1->sin_addr.s_net == sin2->sin_addr.s_net
);
+ return (
inet_netof(sin1->sin_addr) == inet_netof(sin2->sin_addr)
);
}
/*
* Verify the message is from the right port.
*/
inet_portmatch(sin)
}
/*
* Verify the message is from the right port.
*/
inet_portmatch(sin)
- struct sockaddr_in *sin;
+
register
struct sockaddr_in *sin;
{
{
- int port = sin->sin_port;
#if vax || pdp11
#if vax || pdp11
-
port = ntohs(
port);
+
sin->sin_port = ntohs(sin->sin_
port);
#endif
#endif
- return (
port == IPPORT_ROUTESERVER || port == IPPORT_ROUTESERVER
+1);
+ return (
sin->sin_port == sp->s_port || sin->sin_port == sp->s_port
+1);
}
/*
* Verify the message is from a "trusted" port.
*/
inet_portcheck(sin)
}
/*
* Verify the message is from a "trusted" port.
*/
inet_portcheck(sin)
- struct sockaddr_in *sin;
+
register
struct sockaddr_in *sin;
{
{
- int port = sin->sin_port;
#if vax || pdp11
#if vax || pdp11
-
port = ntohs(
port);
+
sin->sin_port = ntohs(sin->sin_
port);
#endif
#endif
- return (port <= IPPORT_RESERVED);
+ return (
sin->sin_
port <= IPPORT_RESERVED);
}
/*
}
/*
@@
-93,28
+83,20
@@
inet_output(s, sin, size)
dst = *sin;
sin = &dst;
dst = *sin;
sin = &dst;
- if (sin->sin_port == 0) {
- sin->sin_port = IPPORT_ROUTESERVER;
-#if vax || pdp11
- sin->sin_port = htons(sin->sin_port);
-#endif
- }
+ if (sin->sin_port == 0)
+ sin->sin_port = htons(sp->s_port);
if (send(s, sin, packet, size) < 0)
if (send(s, sin, packet, size) < 0)
-
tprintf("send to %x: %s\n", sin->sin_addr, sys_errlist[errno]
);
+
perror("send"
);
}
/*
}
/*
- * Return 1 if the address is
for an Internet host,
- *
otherwise assume it's a network address (broadcast)
.
+ * Return 1 if the address is
believed
+ *
for an Internet host -- THIS IS A KLUDGE
.
*/
inet_checkhost(sin)
struct sockaddr_in *sin;
{
*/
inet_checkhost(sin)
struct sockaddr_in *sin;
{
- extern struct in_addr if_makeaddr();
- struct in_addr netaddr;
-
- netaddr = if_makeaddr((int)sin->sin_addr.s_net, INADDR_ANY);
- return (netaddr.s_addr != sin->sin_addr.s_addr);
+ return (inet_lnaof(sin->sin_addr) != 0);
}
inet_canon(sin)
}
inet_canon(sin)