summaryrefslogtreecommitdiffstats
path: root/sys/netatalk/ddp_output.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-07-09 02:00:02 +0000
committerjulian <julian@FreeBSD.org>1998-07-09 02:00:02 +0000
commit8c57af43f0be6d4d032faa8e8fc0afeb53ef5f61 (patch)
tree0e8af151c72efaf5c79d081c98f53433f55833dd /sys/netatalk/ddp_output.c
parentc520e2ce97e9f269b0a58932d9beb04165ffb6e7 (diff)
downloadFreeBSD-src-8c57af43f0be6d4d032faa8e8fc0afeb53ef5f61.zip
FreeBSD-src-8c57af43f0be6d4d032faa8e8fc0afeb53ef5f61.tar.gz
Slight optimisation. Don't do the same calculation twice.
Diffstat (limited to 'sys/netatalk/ddp_output.c')
-rw-r--r--sys/netatalk/ddp_output.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c
index c59a8e3..a56f735 100644
--- a/sys/netatalk/ddp_output.c
+++ b/sys/netatalk/ddp_output.c
@@ -152,6 +152,19 @@ printf( "ddp_route: oops\n" );
}
/*
+ * if the destination address is on a directly attached node use that,
+ * else use the official gateway.
+ */
+ if ( ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) >=
+ ntohs( aa->aa_firstnet ) &&
+ ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) <=
+ ntohs( aa->aa_lastnet )) {
+ gate = *satosat( &ro->ro_dst );
+ } else {
+ gate = *satosat( ro->ro_rt->rt_gateway );
+ }
+
+ /*
* There are several places in the kernel where data is added to
* an mbuf without ensuring that the mbuf pointer is aligned.
* This is bad for transition routing, since phase 1 and phase 2
@@ -172,23 +185,7 @@ printf( "ddp_route: oops\n" );
elh = mtod( m, struct elaphdr *);
elh->el_snode = satosat( &aa->aa_addr )->sat_addr.s_node;
elh->el_type = ELAP_DDPEXTEND;
- if ( ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) >=
- ntohs( aa->aa_firstnet ) &&
- ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) <=
- ntohs( aa->aa_lastnet )) {
- elh->el_dnode = satosat( &ro->ro_dst )->sat_addr.s_node;
- } else {
- elh->el_dnode = satosat( ro->ro_rt->rt_gateway )->sat_addr.s_node;
- }
- }
-
- if ( ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) >=
- ntohs( aa->aa_firstnet ) &&
- ntohs( satosat( &ro->ro_dst )->sat_addr.s_net ) <=
- ntohs( aa->aa_lastnet )) {
- gate = *satosat( &ro->ro_dst );
- } else {
- gate = *satosat( ro->ro_rt->rt_gateway );
+ elh->el_dnode = gate->sat_addr.s_node;
}
ro->ro_rt->rt_use++;
OpenPOWER on IntegriCloud