summaryrefslogtreecommitdiffstats
path: root/sys/netatalk/ddp_output.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1997-08-28 01:17:12 +0000
committerjulian <julian@FreeBSD.org>1997-08-28 01:17:12 +0000
commit6c90e3528c75ea68f2d3c64aa6029c46fa9a701e (patch)
tree936131a84e5e2a9fb9d520c1b4c589af25a536fe /sys/netatalk/ddp_output.c
parentb687a4a7e7ee5a230c473da88d3339c0dd28356b (diff)
downloadFreeBSD-src-6c90e3528c75ea68f2d3c64aa6029c46fa9a701e.zip
FreeBSD-src-6c90e3528c75ea68f2d3c64aa6029c46fa9a701e.tar.gz
Add a per-interface-address pointer to a function that can be supplied
by a protocol, to detirmine if an address matches the net this address is part of. This is needed by protocols for which netmasks "just don't work", for example appletalk. Also add the code in appletalk to make use of this new feature. Thsi fixes one of the longest standing bugs in appletalk. The inability to talk to machines to which the path is via a router which is on a different net, but the same netrange, as your interface. Protocols that do not supply this function (e.g. IP) should not be affected.
Diffstat (limited to 'sys/netatalk/ddp_output.c')
-rw-r--r--sys/netatalk/ddp_output.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c
index 34f010b..9759ccc 100644
--- a/sys/netatalk/ddp_output.c
+++ b/sys/netatalk/ddp_output.c
@@ -119,16 +119,32 @@ ddp_route( struct mbuf *m, struct route *ro)
struct ifnet *ifp = NULL;
u_short net;
- if ( ro->ro_rt && ( ifp = ro->ro_rt->rt_ifp )) {
- net = satosat( ro->ro_rt->rt_gateway )->sat_addr.s_net;
+ /*
+ * if we have a route, find the ifa that refers to this route.
+ * I.e The ifa used to get to the gateway.
+ */
+ if ( (ro->ro_rt == NULL)
+ || ( ro->ro_rt->rt_ifa == NULL )
+ || ( (ifp = ro->ro_rt->rt_ifa->ifa_ifp) == NULL )) {
+ rtalloc(ro);
+ }
+ if ( (ro->ro_rt != NULL)
+ && ( ro->ro_rt->rt_ifa )
+ && ( ifp = ro->ro_rt->rt_ifa->ifa_ifp )) {
+ net = satosat(ro->ro_rt->rt_gateway)->sat_addr.s_net;
for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
- if ( aa->aa_ifp == ifp &&
+ if (((net == 0) || (aa->aa_ifp == ifp)) &&
ntohs( net ) >= ntohs( aa->aa_firstnet ) &&
ntohs( net ) <= ntohs( aa->aa_lastnet )) {
break;
}
}
+ } else {
+ printf( "ddp_route: still have no valid route\n");
+ m_freem( m );
+ return( EINVAL );
}
+
if ( aa == NULL ) {
printf( "ddp_route: oops\n" );
m_freem( m );
OpenPOWER on IntegriCloud