1996-05-24 01:35:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1990,1991 Regents of The University of Michigan.
|
|
|
|
* All Rights Reserved.
|
2000-03-29 17:12:09 +00:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
1996-05-24 01:35:45 +00:00
|
|
|
*/
|
|
|
|
|
1998-01-31 07:23:16 +00:00
|
|
|
#include "opt_atalk.h"
|
2002-08-15 18:58:44 +00:00
|
|
|
#include "opt_mac.h"
|
1998-01-31 07:23:16 +00:00
|
|
|
|
1996-05-24 01:35:45 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2002-08-15 18:58:44 +00:00
|
|
|
#include <sys/mac.h>
|
1996-05-24 01:35:45 +00:00
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/kernel.h>
|
1997-09-07 08:30:24 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/syslog.h>
|
|
|
|
|
1996-05-24 01:35:45 +00:00
|
|
|
#include <net/if.h>
|
1997-09-07 08:30:24 +00:00
|
|
|
|
1996-05-24 01:35:45 +00:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#undef s_net
|
|
|
|
#include <netinet/if_ether.h>
|
|
|
|
|
|
|
|
#include <netatalk/at.h>
|
|
|
|
#include <netatalk/at_var.h>
|
|
|
|
#include <netatalk/aarp.h>
|
|
|
|
#include <netatalk/phase2.h>
|
|
|
|
#include <netatalk/at_extern.h>
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
static void aarptfree(struct aarptab *aat);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
static void at_aarpinput(struct ifnet *ifp, struct mbuf *m);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
#define AARPTAB_BSIZ 9
|
|
|
|
#define AARPTAB_NB 19
|
|
|
|
#define AARPTAB_SIZE (AARPTAB_BSIZ * AARPTAB_NB)
|
1998-02-09 06:11:36 +00:00
|
|
|
static struct aarptab aarptab[AARPTAB_SIZE];
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
static struct mtx aarptab_mtx;
|
|
|
|
MTX_SYSINIT(aarptab_mtx, &aarptab_mtx, "aarptab_mtx", MTX_DEF);
|
|
|
|
|
|
|
|
#define AARPTAB_LOCK() mtx_lock(&aarptab_mtx)
|
|
|
|
#define AARPTAB_UNLOCK() mtx_unlock(&aarptab_mtx)
|
|
|
|
#define AARPTAB_LOCK_ASSERT() mtx_assert(&aarptab_mtx, MA_OWNED)
|
|
|
|
#define AARPTAB_UNLOCK_ASSERT() mtx_assert(&aarptab_mtx, MA_NOTOWNED)
|
|
|
|
|
1996-05-24 01:35:45 +00:00
|
|
|
#define AARPTAB_HASH(a) \
|
2004-03-22 03:24:10 +00:00
|
|
|
((((a).s_net << 8) + (a).s_node) % AARPTAB_NB)
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:57:01 +00:00
|
|
|
#define AARPTAB_LOOK(aat, addr) { \
|
1996-05-24 01:35:45 +00:00
|
|
|
int n; \
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK_ASSERT(); \
|
1996-05-24 01:35:45 +00:00
|
|
|
aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \
|
2004-03-22 03:24:10 +00:00
|
|
|
for (n = 0; n < AARPTAB_BSIZ; n++, aat++) \
|
|
|
|
if (aat->aat_ataddr.s_net == (addr).s_net && \
|
|
|
|
aat->aat_ataddr.s_node == (addr).s_node) \
|
1996-05-24 01:35:45 +00:00
|
|
|
break; \
|
2004-03-22 03:24:10 +00:00
|
|
|
if (n >= AARPTAB_BSIZ) \
|
2004-03-22 03:57:01 +00:00
|
|
|
aat = NULL; \
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define AARPT_AGE (60 * 1)
|
|
|
|
#define AARPT_KILLC 20
|
|
|
|
#define AARPT_KILLI 3
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
# if !defined(__FreeBSD__)
|
1996-05-24 01:35:45 +00:00
|
|
|
extern u_char etherbroadcastaddr[6];
|
2002-05-24 06:11:07 +00:00
|
|
|
# endif /* __FreeBSD__ */
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-13 05:27:17 +00:00
|
|
|
static const u_char atmulticastaddr[ 6 ] = {
|
1996-05-24 01:35:45 +00:00
|
|
|
0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
|
|
|
|
};
|
|
|
|
|
2004-03-13 05:27:17 +00:00
|
|
|
/*
|
|
|
|
* Not used?
|
|
|
|
*/
|
1996-05-24 01:35:45 +00:00
|
|
|
u_char at_org_code[ 3 ] = {
|
|
|
|
0x08, 0x00, 0x07,
|
|
|
|
};
|
2004-03-13 05:27:17 +00:00
|
|
|
const u_char aarp_org_code[ 3 ] = {
|
1996-05-24 01:35:45 +00:00
|
|
|
0x00, 0x00, 0x00,
|
|
|
|
};
|
|
|
|
|
1997-09-21 22:02:25 +00:00
|
|
|
static struct callout_handle aarptimer_ch =
|
|
|
|
CALLOUT_HANDLE_INITIALIZER(&aarptimer_ch);
|
|
|
|
|
1996-05-24 01:35:45 +00:00
|
|
|
static void
|
|
|
|
aarptimer(void *ignored)
|
|
|
|
{
|
|
|
|
struct aarptab *aat;
|
2004-04-09 01:40:12 +00:00
|
|
|
int i;
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptimer_ch = timeout(aarptimer, (caddr_t)0, AARPT_AGE * hz);
|
1996-05-24 01:35:45 +00:00
|
|
|
aat = aarptab;
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
for (i = 0; i < AARPTAB_SIZE; i++, aat++) {
|
|
|
|
if (aat->aat_flags == 0 || (aat->aat_flags & ATF_PERM))
|
1996-05-24 01:35:45 +00:00
|
|
|
continue;
|
2004-03-22 03:24:10 +00:00
|
|
|
if (++aat->aat_timer < ((aat->aat_flags & ATF_COM) ?
|
|
|
|
AARPT_KILLC : AARPT_KILLI))
|
1996-05-24 01:35:45 +00:00
|
|
|
continue;
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptfree(aat);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
1996-08-29 23:16:34 +00:00
|
|
|
/*
|
|
|
|
* search through the network addresses to find one that includes
|
|
|
|
* the given network.. remember to take netranges into
|
|
|
|
* consideration.
|
|
|
|
*/
|
1997-10-29 00:30:52 +00:00
|
|
|
struct at_ifaddr *
|
2004-03-22 03:24:10 +00:00
|
|
|
at_ifawithnet(struct sockaddr_at *sat)
|
1996-05-24 01:35:45 +00:00
|
|
|
{
|
1997-10-29 00:30:52 +00:00
|
|
|
struct at_ifaddr *aa;
|
1996-08-29 23:16:34 +00:00
|
|
|
struct sockaddr_at *sat2;
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 04:50:36 +00:00
|
|
|
for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) {
|
1997-10-29 00:30:52 +00:00
|
|
|
sat2 = &(aa->aa_addr);
|
2004-03-22 03:24:10 +00:00
|
|
|
if (sat2->sat_addr.s_net == sat->sat_addr.s_net) {
|
1997-10-29 00:30:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
if((aa->aa_flags & AFA_PHASE2)
|
1997-10-29 00:30:52 +00:00
|
|
|
&& (ntohs(aa->aa_firstnet) <= ntohs(sat->sat_addr.s_net))
|
|
|
|
&& (ntohs(aa->aa_lastnet) >= ntohs(sat->sat_addr.s_net))) {
|
|
|
|
break;
|
|
|
|
}
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
return (aa);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
aarpwhohas(struct ifnet *ifp, struct sockaddr_at *sat)
|
1996-05-24 01:35:45 +00:00
|
|
|
{
|
|
|
|
struct mbuf *m;
|
|
|
|
struct ether_header *eh;
|
|
|
|
struct ether_aarp *ea;
|
|
|
|
struct at_ifaddr *aa;
|
|
|
|
struct llc *llc;
|
|
|
|
struct sockaddr sa;
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK_ASSERT();
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) {
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-08-15 18:58:44 +00:00
|
|
|
#ifdef MAC
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
mac_create_mbuf_linklayer(ifp, m);
|
2002-08-15 18:58:44 +00:00
|
|
|
#endif
|
2004-03-22 03:24:10 +00:00
|
|
|
m->m_len = sizeof(*ea);
|
|
|
|
m->m_pkthdr.len = sizeof(*ea);
|
|
|
|
MH_ALIGN(m, sizeof(*ea));
|
|
|
|
|
|
|
|
ea = mtod(m, struct ether_aarp *);
|
|
|
|
bzero((caddr_t)ea, sizeof(*ea));
|
|
|
|
|
|
|
|
ea->aarp_hrd = htons(AARPHRD_ETHER);
|
|
|
|
ea->aarp_pro = htons(ETHERTYPE_AT);
|
|
|
|
ea->aarp_hln = sizeof(ea->aarp_sha);
|
|
|
|
ea->aarp_pln = sizeof(ea->aarp_spu);
|
|
|
|
ea->aarp_op = htons(AARPOP_REQUEST);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(IFP2AC(ifp)->ac_enaddr, (caddr_t)ea->aarp_sha,
|
2004-03-22 03:24:10 +00:00
|
|
|
sizeof(ea->aarp_sha));
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to check whether the output ethernet type should
|
|
|
|
* be phase 1 or 2. We have the interface that we'll be sending
|
|
|
|
* the aarp out. We need to find an AppleTalk network on that
|
|
|
|
* interface with the same address as we're looking for. If the
|
|
|
|
* net is phase 2, generate an 802.2 and SNAP header.
|
|
|
|
*/
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((aa = at_ifawithnet(sat)) == NULL) {
|
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
eh = (struct ether_header *)sa.sa_data;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa->aa_flags & AFA_PHASE2) {
|
|
|
|
bcopy(atmulticastaddr, eh->ether_dhost, sizeof(eh->ether_dhost));
|
1996-05-24 01:35:45 +00:00
|
|
|
eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp));
|
2004-03-22 03:24:10 +00:00
|
|
|
M_PREPEND(m, sizeof(struct llc), M_TRYWAIT);
|
|
|
|
if (m == NULL) {
|
2003-08-29 19:27:09 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
llc = mtod(m, struct llc *);
|
1996-05-24 01:35:45 +00:00
|
|
|
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
|
|
|
|
llc->llc_control = LLC_UI;
|
2004-03-13 05:27:17 +00:00
|
|
|
bcopy(aarp_org_code, llc->llc_org_code, sizeof(aarp_org_code));
|
2004-03-22 03:24:10 +00:00
|
|
|
llc->llc_ether_type = htons(ETHERTYPE_AARP);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy(&AA_SAT(aa)->sat_addr.s_net, ea->aarp_spnet,
|
|
|
|
sizeof(ea->aarp_spnet));
|
|
|
|
bcopy(&sat->sat_addr.s_net, ea->aarp_tpnet,
|
|
|
|
sizeof(ea->aarp_tpnet));
|
|
|
|
ea->aarp_spnode = AA_SAT(aa)->sat_addr.s_node;
|
1996-05-24 01:35:45 +00:00
|
|
|
ea->aarp_tpnode = sat->sat_addr.s_node;
|
|
|
|
} else {
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(ifp->if_broadcastaddr, (caddr_t)eh->ether_dhost,
|
2004-03-22 03:24:10 +00:00
|
|
|
sizeof(eh->ether_dhost));
|
|
|
|
eh->ether_type = htons(ETHERTYPE_AARP);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
ea->aarp_spa = AA_SAT(aa)->sat_addr.s_node;
|
1996-05-24 01:35:45 +00:00
|
|
|
ea->aarp_tpa = sat->sat_addr.s_node;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NETATALKDEBUG
|
|
|
|
printf("aarp: sending request for %u.%u\n",
|
2004-03-22 03:24:10 +00:00
|
|
|
ntohs(AA_SAT(aa)->sat_addr.s_net),
|
|
|
|
AA_SAT(aa)->sat_addr.s_node);
|
1998-01-31 07:23:16 +00:00
|
|
|
#endif /* NETATALKDEBUG */
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
sa.sa_len = sizeof(struct sockaddr);
|
1996-05-24 01:35:45 +00:00
|
|
|
sa.sa_family = AF_UNSPEC;
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
ifp->if_output(ifp, m, &sa, NULL /* route */);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
aarpresolve(ifp, m, destsat, desten)
|
|
|
|
struct ifnet *ifp;
|
1996-05-24 01:35:45 +00:00
|
|
|
struct mbuf *m;
|
|
|
|
struct sockaddr_at *destsat;
|
|
|
|
u_char *desten;
|
|
|
|
{
|
|
|
|
struct at_ifaddr *aa;
|
|
|
|
struct aarptab *aat;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (at_broadcast(destsat)) {
|
1997-10-29 00:30:52 +00:00
|
|
|
m->m_flags |= M_BCAST;
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((aa = at_ifawithnet(destsat)) == NULL) {
|
|
|
|
m_freem(m);
|
|
|
|
return (0);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa->aa_flags & AFA_PHASE2) {
|
2004-03-13 05:27:17 +00:00
|
|
|
bcopy(atmulticastaddr, (caddr_t)desten, sizeof(atmulticastaddr));
|
1996-05-24 01:35:45 +00:00
|
|
|
} else {
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(ifp->if_broadcastaddr, (caddr_t)desten,
|
|
|
|
sizeof(ifp->if_addrlen));
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
return (1);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
AARPTAB_LOOK(aat, destsat->sat_addr);
|
2004-03-22 03:57:01 +00:00
|
|
|
if (aat == NULL) { /* No entry */
|
2004-03-22 03:24:10 +00:00
|
|
|
aat = aarptnew(&destsat->sat_addr);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
if (aat == NULL) { /* we should fail more gracefully! */
|
2004-03-22 03:24:10 +00:00
|
|
|
panic("aarpresolve: no free entry");
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
goto done;
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
/* found an entry */
|
|
|
|
aat->aat_timer = 0;
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aat->aat_flags & ATF_COM) { /* entry is COMplete */
|
|
|
|
bcopy((caddr_t)aat->aat_enaddr, (caddr_t)desten,
|
|
|
|
sizeof(aat->aat_enaddr));
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
return (1);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
/* entry has not completed */
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aat->aat_hold) {
|
|
|
|
m_freem(aat->aat_hold);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
done:
|
1996-05-24 01:35:45 +00:00
|
|
|
aat->aat_hold = m;
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
aarpwhohas(ifp, destsat);
|
2004-03-22 03:24:10 +00:00
|
|
|
return (0);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-03-22 03:24:10 +00:00
|
|
|
aarpintr(m)
|
1996-05-24 01:35:45 +00:00
|
|
|
struct mbuf *m;
|
|
|
|
{
|
|
|
|
struct arphdr *ar;
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
struct ifnet *ifp;
|
1996-05-24 01:35:45 +00:00
|
|
|
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
ifp = m->m_pkthdr.rcvif;
|
|
|
|
if (ifp->if_flags & IFF_NOARP)
|
1996-05-24 01:35:45 +00:00
|
|
|
goto out;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (m->m_len < sizeof(struct arphdr)) {
|
1996-05-24 01:35:45 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
ar = mtod(m, struct arphdr *);
|
|
|
|
if (ntohs(ar->ar_hrd) != AARPHRD_ETHER) {
|
1996-05-24 01:35:45 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (m->m_len < sizeof(struct arphdr) + 2 * ar->ar_hln +
|
|
|
|
2 * ar->ar_pln) {
|
1996-05-24 01:35:45 +00:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
switch(ntohs(ar->ar_pro)) {
|
1996-05-24 01:35:45 +00:00
|
|
|
case ETHERTYPE_AT :
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
at_aarpinput(ifp, m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2004-03-22 03:24:10 +00:00
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
at_aarpinput(struct ifnet *ifp, struct mbuf *m)
|
1996-05-24 01:35:45 +00:00
|
|
|
{
|
|
|
|
struct ether_aarp *ea;
|
|
|
|
struct at_ifaddr *aa;
|
|
|
|
struct aarptab *aat;
|
|
|
|
struct ether_header *eh;
|
|
|
|
struct llc *llc;
|
|
|
|
struct sockaddr_at sat;
|
|
|
|
struct sockaddr sa;
|
|
|
|
struct at_addr spa, tpa, ma;
|
1996-07-23 01:18:47 +00:00
|
|
|
int op;
|
1996-05-24 01:35:45 +00:00
|
|
|
u_short net;
|
|
|
|
|
2003-11-08 22:28:40 +00:00
|
|
|
GIANT_REQUIRED;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
ea = mtod(m, struct ether_aarp *);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
/* Check to see if from my hardware address */
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
if (!bcmp((caddr_t)ea->aarp_sha, IFP2AC(ifp)->ac_enaddr,
|
|
|
|
sizeof(IFP2AC(ifp)->ac_enaddr))) {
|
2004-03-22 03:24:10 +00:00
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
op = ntohs(ea->aarp_op);
|
|
|
|
bcopy(ea->aarp_tpnet, &net, sizeof(net));
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (net != 0) { /* should be ATADDR_ANYNET? */
|
1996-05-24 01:35:45 +00:00
|
|
|
sat.sat_len = sizeof(struct sockaddr_at);
|
|
|
|
sat.sat_family = AF_APPLETALK;
|
|
|
|
sat.sat_addr.s_net = net;
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((aa = at_ifawithnet(&sat)) == NULL) {
|
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy(ea->aarp_spnet, &spa.s_net, sizeof(spa.s_net));
|
|
|
|
bcopy(ea->aarp_tpnet, &tpa.s_net, sizeof(tpa.s_net));
|
1996-05-24 01:35:45 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Since we don't know the net, we just look for the first
|
|
|
|
* phase 1 address on the interface.
|
|
|
|
*/
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa;
|
1996-12-13 21:29:07 +00:00
|
|
|
aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
|
2004-03-22 03:24:10 +00:00
|
|
|
if (AA_SAT(aa)->sat_family == AF_APPLETALK &&
|
|
|
|
(aa->aa_flags & AFA_PHASE2) == 0) {
|
1996-05-24 01:35:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa == NULL) {
|
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net;
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
spa.s_node = ea->aarp_spnode;
|
|
|
|
tpa.s_node = ea->aarp_tpnode;
|
2004-03-22 03:24:10 +00:00
|
|
|
ma.s_net = AA_SAT(aa)->sat_addr.s_net;
|
|
|
|
ma.s_node = AA_SAT(aa)->sat_addr.s_node;
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This looks like it's from us.
|
|
|
|
*/
|
2004-03-22 03:24:10 +00:00
|
|
|
if (spa.s_net == ma.s_net && spa.s_node == ma.s_node) {
|
|
|
|
if (aa->aa_flags & AFA_PROBING) {
|
1996-05-24 01:35:45 +00:00
|
|
|
/*
|
|
|
|
* We're probing, someone either responded to our probe, or
|
|
|
|
* probed for the same address we'd like to use. Change the
|
|
|
|
* address we're probing for.
|
|
|
|
*/
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
untimeout(aarpprobe, ifp, aa->aa_ch);
|
2004-03-22 03:24:10 +00:00
|
|
|
wakeup(aa);
|
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
2004-03-22 03:24:10 +00:00
|
|
|
} else if (op != AARPOP_PROBE) {
|
1996-05-24 01:35:45 +00:00
|
|
|
/*
|
|
|
|
* This is not a probe, and we're not probing. This means
|
|
|
|
* that someone's saying they have the same source address
|
|
|
|
* as the one we're using. Get upset...
|
|
|
|
*/
|
2004-03-22 03:24:10 +00:00
|
|
|
log(LOG_ERR,
|
1996-05-24 01:35:45 +00:00
|
|
|
"aarp: duplicate AT address!! %x:%x:%x:%x:%x:%x\n",
|
|
|
|
ea->aarp_sha[ 0 ], ea->aarp_sha[ 1 ], ea->aarp_sha[ 2 ],
|
|
|
|
ea->aarp_sha[ 3 ], ea->aarp_sha[ 4 ], ea->aarp_sha[ 5 ]);
|
2004-03-22 03:24:10 +00:00
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
AARPTAB_LOOK(aat, spa);
|
2004-03-22 03:57:01 +00:00
|
|
|
if (aat != NULL) {
|
2004-03-22 03:24:10 +00:00
|
|
|
if (op == AARPOP_PROBE) {
|
1996-05-24 01:35:45 +00:00
|
|
|
/*
|
|
|
|
* Someone's probing for spa, dealocate the one we've got,
|
|
|
|
* so that if the prober keeps the address, we'll be able
|
|
|
|
* to arp for him.
|
|
|
|
*/
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptfree(aat);
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy((caddr_t)ea->aarp_sha, (caddr_t)aat->aat_enaddr,
|
|
|
|
sizeof(ea->aarp_sha));
|
1996-05-24 01:35:45 +00:00
|
|
|
aat->aat_flags |= ATF_COM;
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aat->aat_hold) {
|
2000-03-29 17:12:09 +00:00
|
|
|
struct mbuf *mhold = aat->aat_hold;
|
|
|
|
aat->aat_hold = NULL;
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
1996-05-24 01:35:45 +00:00
|
|
|
sat.sat_len = sizeof(struct sockaddr_at);
|
|
|
|
sat.sat_family = AF_APPLETALK;
|
|
|
|
sat.sat_addr = spa;
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
(*ifp->if_output)(ifp, mhold,
|
1996-07-23 01:18:47 +00:00
|
|
|
(struct sockaddr *)&sat, NULL); /* XXX */
|
2004-04-09 01:40:12 +00:00
|
|
|
} else
|
|
|
|
AARPTAB_UNLOCK();
|
2000-03-29 17:12:09 +00:00
|
|
|
} else if ((tpa.s_net == ma.s_net)
|
|
|
|
&& (tpa.s_node == ma.s_node)
|
|
|
|
&& (op != AARPOP_PROBE)
|
2004-03-22 03:24:10 +00:00
|
|
|
&& ((aat = aarptnew(&spa)) != NULL)) {
|
|
|
|
bcopy((caddr_t)ea->aarp_sha, (caddr_t)aat->aat_enaddr,
|
|
|
|
sizeof(ea->aarp_sha));
|
|
|
|
aat->aat_flags |= ATF_COM;
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
|
|
|
} else
|
|
|
|
AARPTAB_UNLOCK();
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Don't respond to responses, and never respond if we're
|
|
|
|
* still probing.
|
|
|
|
*/
|
2004-03-22 03:24:10 +00:00
|
|
|
if (tpa.s_net != ma.s_net || tpa.s_node != ma.s_node ||
|
|
|
|
op == AARPOP_RESPONSE || (aa->aa_flags & AFA_PROBING)) {
|
|
|
|
m_freem(m);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy((caddr_t)ea->aarp_sha, (caddr_t)ea->aarp_tha,
|
|
|
|
sizeof(ea->aarp_sha));
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(IFP2AC(ifp)->ac_enaddr, (caddr_t)ea->aarp_sha,
|
2004-03-22 03:24:10 +00:00
|
|
|
sizeof(ea->aarp_sha));
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
/* XXX */
|
|
|
|
eh = (struct ether_header *)sa.sa_data;
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy((caddr_t)ea->aarp_tha, (caddr_t)eh->ether_dhost,
|
|
|
|
sizeof(eh->ether_dhost));
|
|
|
|
|
|
|
|
if (aa->aa_flags & AFA_PHASE2) {
|
|
|
|
eh->ether_type = htons(sizeof(struct llc) +
|
|
|
|
sizeof(struct ether_aarp));
|
|
|
|
M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
|
|
|
|
if (m == NULL) {
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
llc = mtod(m, struct llc *);
|
1996-05-24 01:35:45 +00:00
|
|
|
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
|
|
|
|
llc->llc_control = LLC_UI;
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy(aarp_org_code, llc->llc_org_code, sizeof(aarp_org_code));
|
|
|
|
llc->llc_ether_type = htons(ETHERTYPE_AARP);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy(ea->aarp_spnet, ea->aarp_tpnet, sizeof(ea->aarp_tpnet));
|
|
|
|
bcopy(&ma.s_net, ea->aarp_spnet, sizeof(ea->aarp_spnet));
|
1996-05-24 01:35:45 +00:00
|
|
|
} else {
|
2004-03-22 03:24:10 +00:00
|
|
|
eh->ether_type = htons(ETHERTYPE_AARP);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ea->aarp_tpnode = ea->aarp_spnode;
|
|
|
|
ea->aarp_spnode = ma.s_node;
|
2004-03-22 03:24:10 +00:00
|
|
|
ea->aarp_op = htons(AARPOP_RESPONSE);
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
sa.sa_len = sizeof(struct sockaddr);
|
1996-05-24 01:35:45 +00:00
|
|
|
sa.sa_family = AF_UNSPEC;
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
(*ifp->if_output)(ifp, m, &sa, NULL); /* XXX */
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptfree(struct aarptab *aat)
|
1996-05-24 01:35:45 +00:00
|
|
|
{
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK_ASSERT();
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aat->aat_hold)
|
|
|
|
m_freem(aat->aat_hold);
|
2000-03-29 17:12:09 +00:00
|
|
|
aat->aat_hold = NULL;
|
1996-05-24 01:35:45 +00:00
|
|
|
aat->aat_timer = aat->aat_flags = 0;
|
|
|
|
aat->aat_ataddr.s_net = 0;
|
|
|
|
aat->aat_ataddr.s_node = 0;
|
|
|
|
}
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
struct aarptab *
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptnew(addr)
|
1996-05-24 01:35:45 +00:00
|
|
|
struct at_addr *addr;
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
int oldest = -1;
|
|
|
|
struct aarptab *aat, *aato = NULL;
|
|
|
|
static int first = 1;
|
|
|
|
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK_ASSERT();
|
2004-03-22 03:24:10 +00:00
|
|
|
if (first) {
|
1996-05-24 01:35:45 +00:00
|
|
|
first = 0;
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptimer_ch = timeout(aarptimer, (caddr_t)0, hz);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
aat = &aarptab[ AARPTAB_HASH(*addr) * AARPTAB_BSIZ ];
|
|
|
|
for (n = 0; n < AARPTAB_BSIZ; n++, aat++) {
|
|
|
|
if (aat->aat_flags == 0)
|
1996-05-24 01:35:45 +00:00
|
|
|
goto out;
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aat->aat_flags & ATF_PERM)
|
1996-05-24 01:35:45 +00:00
|
|
|
continue;
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((int) aat->aat_timer > oldest) {
|
1996-05-24 01:35:45 +00:00
|
|
|
oldest = aat->aat_timer;
|
|
|
|
aato = aat;
|
|
|
|
}
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aato == NULL)
|
|
|
|
return (NULL);
|
1996-05-24 01:35:45 +00:00
|
|
|
aat = aato;
|
2004-03-22 03:24:10 +00:00
|
|
|
aarptfree(aat);
|
1996-05-24 01:35:45 +00:00
|
|
|
out:
|
|
|
|
aat->aat_ataddr = *addr;
|
|
|
|
aat->aat_flags = ATF_INUSE;
|
2004-03-22 03:24:10 +00:00
|
|
|
return (aat);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2004-03-22 03:24:10 +00:00
|
|
|
aarpprobe(void *arg)
|
1996-05-24 01:35:45 +00:00
|
|
|
{
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
struct ifnet *ifp = arg;
|
1996-05-24 01:35:45 +00:00
|
|
|
struct mbuf *m;
|
|
|
|
struct ether_header *eh;
|
|
|
|
struct ether_aarp *ea;
|
|
|
|
struct at_ifaddr *aa;
|
|
|
|
struct llc *llc;
|
|
|
|
struct sockaddr sa;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We need to check whether the output ethernet type should
|
|
|
|
* be phase 1 or 2. We have the interface that we'll be sending
|
|
|
|
* the aarp out. We need to find an AppleTalk network on that
|
|
|
|
* interface with the same address as we're looking for. If the
|
|
|
|
* net is phase 2, generate an 802.2 and SNAP header.
|
|
|
|
*/
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa;
|
1996-12-13 21:29:07 +00:00
|
|
|
aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
|
2004-03-22 03:24:10 +00:00
|
|
|
if (AA_SAT(aa)->sat_family == AF_APPLETALK &&
|
|
|
|
(aa->aa_flags & AFA_PROBING)) {
|
1996-05-24 01:35:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa == NULL) { /* serious error XXX */
|
|
|
|
printf("aarpprobe why did this happen?!\n");
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa->aa_probcnt <= 0) {
|
1996-05-24 01:35:45 +00:00
|
|
|
aa->aa_flags &= ~AFA_PROBING;
|
2004-03-22 03:24:10 +00:00
|
|
|
wakeup(aa);
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
} else {
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
aa->aa_ch = timeout(aarpprobe, (caddr_t)ifp, hz / 5);
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) {
|
1996-05-24 01:35:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-08-15 18:58:44 +00:00
|
|
|
#ifdef MAC
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
mac_create_mbuf_linklayer(ifp, m);
|
2002-08-15 18:58:44 +00:00
|
|
|
#endif
|
2004-03-22 03:24:10 +00:00
|
|
|
m->m_len = sizeof(*ea);
|
|
|
|
m->m_pkthdr.len = sizeof(*ea);
|
|
|
|
MH_ALIGN(m, sizeof(*ea));
|
|
|
|
|
|
|
|
ea = mtod(m, struct ether_aarp *);
|
|
|
|
bzero((caddr_t)ea, sizeof(*ea));
|
|
|
|
|
|
|
|
ea->aarp_hrd = htons(AARPHRD_ETHER);
|
|
|
|
ea->aarp_pro = htons(ETHERTYPE_AT);
|
|
|
|
ea->aarp_hln = sizeof(ea->aarp_sha);
|
|
|
|
ea->aarp_pln = sizeof(ea->aarp_spu);
|
|
|
|
ea->aarp_op = htons(AARPOP_PROBE);
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(IFP2AC(ifp)->ac_enaddr, (caddr_t)ea->aarp_sha,
|
2004-03-22 03:24:10 +00:00
|
|
|
sizeof(ea->aarp_sha));
|
1996-05-24 01:35:45 +00:00
|
|
|
|
|
|
|
eh = (struct ether_header *)sa.sa_data;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
if (aa->aa_flags & AFA_PHASE2) {
|
|
|
|
bcopy(atmulticastaddr, eh->ether_dhost, sizeof(eh->ether_dhost));
|
|
|
|
eh->ether_type = htons(sizeof(struct llc) +
|
|
|
|
sizeof(struct ether_aarp));
|
|
|
|
M_PREPEND(m, sizeof(struct llc), M_TRYWAIT);
|
|
|
|
if (m == NULL) {
|
2003-08-29 19:27:09 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-03-22 03:24:10 +00:00
|
|
|
llc = mtod(m, struct llc *);
|
1996-05-24 01:35:45 +00:00
|
|
|
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
|
|
|
|
llc->llc_control = LLC_UI;
|
2004-03-22 03:24:10 +00:00
|
|
|
bcopy(aarp_org_code, llc->llc_org_code, sizeof(aarp_org_code));
|
|
|
|
llc->llc_ether_type = htons(ETHERTYPE_AARP);
|
|
|
|
|
|
|
|
bcopy(&AA_SAT(aa)->sat_addr.s_net, ea->aarp_spnet,
|
|
|
|
sizeof(ea->aarp_spnet));
|
|
|
|
bcopy(&AA_SAT(aa)->sat_addr.s_net, ea->aarp_tpnet,
|
|
|
|
sizeof(ea->aarp_tpnet));
|
|
|
|
ea->aarp_spnode = ea->aarp_tpnode = AA_SAT(aa)->sat_addr.s_node;
|
1996-05-24 01:35:45 +00:00
|
|
|
} else {
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
bcopy(ifp->if_broadcastaddr, (caddr_t)eh->ether_dhost,
|
2004-03-22 03:24:10 +00:00
|
|
|
sizeof(eh->ether_dhost));
|
|
|
|
eh->ether_type = htons(ETHERTYPE_AARP);
|
|
|
|
ea->aarp_spa = ea->aarp_tpa = AA_SAT(aa)->sat_addr.s_node;
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef NETATALKDEBUG
|
|
|
|
printf("aarp: sending probe for %u.%u\n",
|
2004-03-22 03:24:10 +00:00
|
|
|
ntohs(AA_SAT(aa)->sat_addr.s_net),
|
|
|
|
AA_SAT(aa)->sat_addr.s_node);
|
1998-01-31 07:23:16 +00:00
|
|
|
#endif /* NETATALKDEBUG */
|
1996-05-24 01:35:45 +00:00
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
sa.sa_len = sizeof(struct sockaddr);
|
1996-05-24 01:35:45 +00:00
|
|
|
sa.sa_family = AF_UNSPEC;
|
This commit does two things:
1. rt_check() cleanup:
rt_check() is only necessary for some address families to gain access
to the corresponding arp entry, so call it only in/near the *resolve()
routines where it is actually used -- at the moment this is
arpresolve(), nd6_storelladdr() (the call is embedded here),
and atmresolve() (the call is just before atmresolve to reduce
the number of changes).
This change will make it a lot easier to decouple the arp table
from the routing table.
There is an extra call to rt_check() in if_iso88025subr.c to
determine the routing info length. I have left it alone for
the time being.
The interface of arpresolve() and nd6_storelladdr() now changes slightly:
+ the 'rtentry' parameter (really a hint from the upper level layer)
is now passed unchanged from *_output(), so it becomes the route
to the final destination and not to the gateway.
+ the routines will return 0 if resolution is possible, non-zero
otherwise.
+ arpresolve() returns EWOULDBLOCK in case the mbuf is being held
waiting for an arp reply -- in this case the error code is masked
in the caller so the upper layer protocol will not see a failure.
2. arpcom untangling
Where possible, use 'struct ifnet' instead of 'struct arpcom' variables,
and use the IFP2AC macro to access arpcom fields.
This mostly affects the netatalk code.
=== Detailed changes: ===
net/if_arcsubr.c
rt_check() cleanup, remove a useless variable
net/if_atmsubr.c
rt_check() cleanup
net/if_ethersubr.c
rt_check() cleanup, arpcom untangling
net/if_fddisubr.c
rt_check() cleanup, arpcom untangling
net/if_iso88025subr.c
rt_check() cleanup
netatalk/aarp.c
arpcom untangling, remove a block of duplicated code
netatalk/at_extern.h
arpcom untangling
netinet/if_ether.c
rt_check() cleanup (change arpresolve)
netinet6/nd6.c
rt_check() cleanup (change nd6_storelladdr)
2004-04-25 09:24:52 +00:00
|
|
|
(*ifp->if_output)(ifp, m, &sa, NULL); /* XXX */
|
1996-05-24 01:35:45 +00:00
|
|
|
aa->aa_probcnt--;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
aarp_clean(void)
|
|
|
|
{
|
|
|
|
struct aarptab *aat;
|
|
|
|
int i;
|
|
|
|
|
2004-03-22 03:24:10 +00:00
|
|
|
untimeout(aarptimer, 0, aarptimer_ch);
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_LOCK();
|
2004-03-22 03:24:10 +00:00
|
|
|
for (i = 0, aat = aarptab; i < AARPTAB_SIZE; i++, aat++) {
|
|
|
|
if (aat->aat_hold) {
|
|
|
|
m_freem(aat->aat_hold);
|
2000-03-29 17:12:09 +00:00
|
|
|
aat->aat_hold = NULL;
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|
|
|
|
}
|
2004-04-09 01:40:12 +00:00
|
|
|
AARPTAB_UNLOCK();
|
1996-05-24 01:35:45 +00:00
|
|
|
}
|