Add if_broadcastaddr to struct ifnet to hold the link layer broadcast address.
[dragonfly.git] / sys / netproto / atalk / aarp.c
1 /*
2  * Copyright (c) 1990,1991 Regents of The University of Michigan.
3  * All Rights Reserved.
4  *
5  * $FreeBSD: src/sys/netatalk/aarp.c,v 1.12.2.2 2001/06/23 20:43:09 iedowse Exp $
6  * $DragonFly: src/sys/netproto/atalk/aarp.c,v 1.12 2004/07/17 09:43:06 joerg Exp $
7  */
8
9 #include "opt_atalk.h"
10
11 #include <sys/param.h>
12 #include <sys/systm.h>
13 #include <sys/mbuf.h>
14 #include <sys/kernel.h>
15 #include <sys/socket.h>
16 #include <sys/syslog.h>
17
18 #include <sys/thread2.h>
19 #include <sys/msgport2.h>
20
21 #include <net/if.h>
22 #include <net/netisr.h>
23
24 #include <netinet/in.h>
25 #undef s_net
26 #include <netinet/if_ether.h>
27
28 #include "at.h"
29 #include "at_var.h"
30 #include "aarp.h"
31 #include "phase2.h"
32 #include "at_extern.h"
33
34 static void aarptfree( struct aarptab *aat);
35 static void at_aarpinput( struct arpcom *ac, struct mbuf *m);
36
37 #define AARPTAB_BSIZ    9
38 #define AARPTAB_NB      19
39 #define AARPTAB_SIZE    (AARPTAB_BSIZ * AARPTAB_NB)
40 static struct aarptab   aarptab[AARPTAB_SIZE];
41
42 #define AARPTAB_HASH(a) \
43     ((((a).s_net << 8 ) + (a).s_node ) % AARPTAB_NB )
44
45 #define AARPTAB_LOOK(aat,addr) { \
46     int         n; \
47     aat = &aarptab[ AARPTAB_HASH(addr) * AARPTAB_BSIZ ]; \
48     for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) \
49         if ( aat->aat_ataddr.s_net == (addr).s_net && \
50              aat->aat_ataddr.s_node == (addr).s_node ) \
51             break; \
52         if ( n >= AARPTAB_BSIZ ) \
53             aat = 0; \
54 }
55
56 #define AARPT_AGE       (60 * 1)
57 #define AARPT_KILLC     20
58 #define AARPT_KILLI     3
59
60 static u_char atmulticastaddr[ 6 ] = {
61     0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
62 };
63
64 u_char  at_org_code[ 3 ] = {
65     0x08, 0x00, 0x07,
66 };
67 u_char  aarp_org_code[ 3 ] = {
68     0x00, 0x00, 0x00,
69 };
70
71 static struct callout_handle aarptimer_ch =
72     CALLOUT_HANDLE_INITIALIZER(&aarptimer_ch);
73
74 static void
75 aarptimer(void *ignored)
76 {
77     struct aarptab      *aat;
78     int                 i, s;
79
80     aarptimer_ch = timeout( aarptimer, (caddr_t)0, AARPT_AGE * hz );
81     aat = aarptab;
82     for ( i = 0; i < AARPTAB_SIZE; i++, aat++ ) {
83         if ( aat->aat_flags == 0 || ( aat->aat_flags & ATF_PERM ))
84             continue;
85         if ( ++aat->aat_timer < (( aat->aat_flags & ATF_COM ) ?
86                 AARPT_KILLC : AARPT_KILLI ))
87             continue;
88         s = splimp();
89         aarptfree( aat );
90         splx( s );
91     }
92 }
93
94 /* 
95  * search through the network addresses to find one that includes
96  * the given network.. remember to take netranges into
97  * consideration.
98  */
99 struct at_ifaddr *
100 at_ifawithnet(struct sockaddr_at  *sat )
101 {
102     struct at_ifaddr    *aa;
103     struct sockaddr_at  *sat2;
104
105         for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
106                 sat2 = &(aa->aa_addr);
107                 if ( sat2->sat_addr.s_net == sat->sat_addr.s_net ) {
108                         break;
109                 }
110                 if( (aa->aa_flags & AFA_PHASE2 )
111                 && (ntohs(aa->aa_firstnet) <= ntohs(sat->sat_addr.s_net))
112                 && (ntohs(aa->aa_lastnet) >= ntohs(sat->sat_addr.s_net))) {
113                         break;
114                 }
115         }
116         return( aa );
117 }
118
119 static void
120 aarpwhohas( struct arpcom *ac, struct sockaddr_at *sat )
121 {
122     struct mbuf         *m;
123     struct ether_header *eh;
124     struct ether_aarp   *ea;
125     struct at_ifaddr    *aa;
126     struct llc          *llc;
127     struct sockaddr     sa;
128
129     if (( m = m_gethdr( MB_DONTWAIT, MT_DATA )) == NULL ) {
130         return;
131     }
132     m->m_len = sizeof( *ea );
133     m->m_pkthdr.len = sizeof( *ea );
134     MH_ALIGN( m, sizeof( *ea ));
135
136     ea = mtod( m, struct ether_aarp *);
137     bzero((caddr_t)ea, sizeof( *ea ));
138
139     ea->aarp_hrd = htons( AARPHRD_ETHER );
140     ea->aarp_pro = htons( ETHERTYPE_AT );
141     ea->aarp_hln = sizeof( ea->aarp_sha );
142     ea->aarp_pln = sizeof( ea->aarp_spu );
143     ea->aarp_op = htons( AARPOP_REQUEST );
144     bcopy((caddr_t)ac->ac_enaddr, (caddr_t)ea->aarp_sha,
145             sizeof( ea->aarp_sha ));
146
147     /*
148      * We need to check whether the output ethernet type should
149      * be phase 1 or 2. We have the interface that we'll be sending
150      * the aarp out. We need to find an AppleTalk network on that
151      * interface with the same address as we're looking for. If the
152      * net is phase 2, generate an 802.2 and SNAP header.
153      */
154     if ((aa = at_ifawithnet( sat )) == NULL) {
155         m_freem( m );
156         return;
157     }
158
159     eh = (struct ether_header *)sa.sa_data;
160
161     if ( aa->aa_flags & AFA_PHASE2 ) {
162         bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
163                 sizeof( eh->ether_dhost ));
164         eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp));
165         M_PREPEND( m, sizeof( struct llc ), MB_WAIT );
166         llc = mtod( m, struct llc *);
167         llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
168         llc->llc_control = LLC_UI;
169         bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
170         llc->llc_ether_type = htons( ETHERTYPE_AARP );
171
172         bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
173                sizeof( ea->aarp_spnet ));
174         bcopy( &sat->sat_addr.s_net, ea->aarp_tpnet,
175                sizeof( ea->aarp_tpnet ));
176         ea->aarp_spnode = AA_SAT( aa )->sat_addr.s_node;
177         ea->aarp_tpnode = sat->sat_addr.s_node;
178     } else {
179         bcopy(ac->ac_if.if_broadcastaddr, eh->ether_dhost,
180               ac->ac_if.if_addrlen);
181         eh->ether_type = htons( ETHERTYPE_AARP );
182
183         ea->aarp_spa = AA_SAT( aa )->sat_addr.s_node;
184         ea->aarp_tpa = sat->sat_addr.s_node;
185     }
186
187 #ifdef NETATALKDEBUG
188     printf("aarp: sending request for %u.%u\n",
189            ntohs(AA_SAT( aa )->sat_addr.s_net),
190            AA_SAT( aa )->sat_addr.s_node);
191 #endif /* NETATALKDEBUG */
192
193     sa.sa_len = sizeof( struct sockaddr );
194     sa.sa_family = AF_UNSPEC;
195     (*ac->ac_if.if_output)(&ac->ac_if,
196         m, &sa, NULL);  /* XXX NULL should be routing information */
197 }
198
199 int
200 aarpresolve( ac, m, destsat, desten )
201     struct arpcom       *ac;
202     struct mbuf         *m;
203     struct sockaddr_at  *destsat;
204     u_char              *desten;
205 {
206     struct at_ifaddr    *aa;
207     struct aarptab      *aat;
208     int                 s;
209
210     if ( at_broadcast( destsat )) {
211         m->m_flags |= M_BCAST;
212         if ((aa = at_ifawithnet( destsat )) == NULL)  {
213             m_freem( m );
214             return( 0 );
215         }
216         if ( aa->aa_flags & AFA_PHASE2 ) {
217             bcopy( (caddr_t)atmulticastaddr, (caddr_t)desten,
218                     sizeof( atmulticastaddr ));
219         } else {
220             bcopy(ac->ac_if.if_broadcastaddr, desten, ac->ac_if.if_addrlen);
221         }
222         return( 1 );
223     }
224
225     s = splimp();
226     AARPTAB_LOOK( aat, destsat->sat_addr );
227     if ( aat == 0 ) {                   /* No entry */
228         aat = aarptnew( &destsat->sat_addr );
229         if ( aat == 0 ) {
230             panic( "aarpresolve: no free entry" );
231         }
232         aat->aat_hold = m;
233         aarpwhohas( ac, destsat );
234         splx( s );
235         return( 0 );
236     }
237     /* found an entry */
238     aat->aat_timer = 0;
239     if ( aat->aat_flags & ATF_COM ) {   /* entry is COMplete */
240         bcopy( (caddr_t)aat->aat_enaddr, (caddr_t)desten,
241                 sizeof( aat->aat_enaddr ));
242         splx( s );
243         return( 1 );
244     }
245     /* entry has not completed */
246     if ( aat->aat_hold ) {
247         m_freem( aat->aat_hold );
248     }
249     aat->aat_hold = m;
250     aarpwhohas( ac, destsat );
251     splx( s );
252     return( 0 );
253 }
254
255 int
256 aarpintr(struct netmsg *msg)
257 {
258     struct mbuf *m = ((struct netmsg_packet *)msg)->nm_packet;   
259     struct arphdr       *ar;
260     struct arpcom       *ac;
261
262     ac = (struct arpcom *)m->m_pkthdr.rcvif;
263     if ( ac->ac_if.if_flags & IFF_NOARP )
264         goto out;
265
266     if ( m->m_len < sizeof( struct arphdr )) {
267         goto out;
268     }
269
270     ar = mtod( m, struct arphdr *);
271     if ( ntohs( ar->ar_hrd ) != AARPHRD_ETHER ) {
272         goto out;
273     }
274     
275     if ( m->m_len < sizeof( struct arphdr ) + 2 * ar->ar_hln +
276             2 * ar->ar_pln ) {
277         goto out;
278     }
279     
280     switch( ntohs( ar->ar_pro )) {
281     case ETHERTYPE_AT :
282         at_aarpinput( ac, m );
283         goto out2;
284
285     default:
286         break;
287     }
288
289 out:
290     m_freem(m);
291 out2:
292     lwkt_replymsg(&msg->nm_lmsg, 0);
293     return(EASYNC);
294 }
295
296 static void
297 at_aarpinput( struct arpcom *ac, struct mbuf *m)
298 {
299     struct ether_aarp   *ea;
300     struct at_ifaddr    *aa;
301     struct aarptab      *aat;
302     struct ether_header *eh;
303     struct llc          *llc;
304     struct sockaddr_at  sat;
305     struct sockaddr     sa;
306     struct at_addr      spa, tpa, ma;
307     int                 op;
308     u_short             net;
309
310     ea = mtod( m, struct ether_aarp *);
311
312     /* Check to see if from my hardware address */
313     if ( !bcmp(( caddr_t )ea->aarp_sha, ( caddr_t )ac->ac_enaddr,
314             sizeof( ac->ac_enaddr ))) {
315         m_freem( m );
316         return;
317     }
318
319     op = ntohs( ea->aarp_op );
320     bcopy( ea->aarp_tpnet, &net, sizeof( net ));
321
322     if ( net != 0 ) { /* should be ATADDR_ANYNET? */
323         sat.sat_len = sizeof(struct sockaddr_at);
324         sat.sat_family = AF_APPLETALK;
325         sat.sat_addr.s_net = net;
326         if ((aa = at_ifawithnet( &sat )) == NULL) {
327             m_freem( m );
328             return;
329         }
330         bcopy( ea->aarp_spnet, &spa.s_net, sizeof( spa.s_net ));
331         bcopy( ea->aarp_tpnet, &tpa.s_net, sizeof( tpa.s_net ));
332     } else {
333         /*
334          * Since we don't know the net, we just look for the first
335          * phase 1 address on the interface.
336          */
337         for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa;
338                 aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
339             if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
340                     ( aa->aa_flags & AFA_PHASE2 ) == 0 ) {
341                 break;
342             }
343         }
344         if ( aa == NULL ) {
345             m_freem( m );
346             return;
347         }
348         tpa.s_net = spa.s_net = AA_SAT( aa )->sat_addr.s_net;
349     }
350
351     spa.s_node = ea->aarp_spnode;
352     tpa.s_node = ea->aarp_tpnode;
353     ma.s_net = AA_SAT( aa )->sat_addr.s_net;
354     ma.s_node = AA_SAT( aa )->sat_addr.s_node;
355
356     /*
357      * This looks like it's from us.
358      */
359     if ( spa.s_net == ma.s_net && spa.s_node == ma.s_node ) {
360         if ( aa->aa_flags & AFA_PROBING ) {
361             /*
362              * We're probing, someone either responded to our probe, or
363              * probed for the same address we'd like to use. Change the
364              * address we're probing for.
365              */
366             untimeout( aarpprobe, ac, aa->aa_ch );
367             wakeup( aa );
368             m_freem( m );
369             return;
370         } else if ( op != AARPOP_PROBE ) {
371             /*
372              * This is not a probe, and we're not probing. This means
373              * that someone's saying they have the same source address
374              * as the one we're using. Get upset...
375              */
376             log( LOG_ERR,
377                     "aarp: duplicate AT address!! %x:%x:%x:%x:%x:%x\n",
378                     ea->aarp_sha[ 0 ], ea->aarp_sha[ 1 ], ea->aarp_sha[ 2 ],
379                     ea->aarp_sha[ 3 ], ea->aarp_sha[ 4 ], ea->aarp_sha[ 5 ]);
380             m_freem( m );
381             return;
382         }
383     }
384
385     AARPTAB_LOOK( aat, spa );
386     if ( aat ) {
387         if ( op == AARPOP_PROBE ) {
388             /*
389              * Someone's probing for spa, dealocate the one we've got,
390              * so that if the prober keeps the address, we'll be able
391              * to arp for him.
392              */
393             aarptfree( aat );
394             m_freem( m );
395             return;
396         }
397
398         bcopy(( caddr_t )ea->aarp_sha, ( caddr_t )aat->aat_enaddr,
399                 sizeof( ea->aarp_sha ));
400         aat->aat_flags |= ATF_COM;
401         if ( aat->aat_hold ) {
402             struct mbuf *mhold = aat->aat_hold;
403             aat->aat_hold = NULL;
404             sat.sat_len = sizeof(struct sockaddr_at);
405             sat.sat_family = AF_APPLETALK;
406             sat.sat_addr = spa;
407             (*ac->ac_if.if_output)( &ac->ac_if, mhold,
408                     (struct sockaddr *)&sat, NULL); /* XXX */
409         }
410     } else if ((tpa.s_net == ma.s_net)
411            && (tpa.s_node == ma.s_node)
412            && (op != AARPOP_PROBE)
413            && ((aat = aarptnew( &spa )) != NULL)) {
414                 bcopy(( caddr_t )ea->aarp_sha, ( caddr_t )aat->aat_enaddr,
415                     sizeof( ea->aarp_sha ));
416                 aat->aat_flags |= ATF_COM;
417     }
418
419     /*
420      * Don't respond to responses, and never respond if we're
421      * still probing.
422      */
423     if ( tpa.s_net != ma.s_net || tpa.s_node != ma.s_node ||
424             op == AARPOP_RESPONSE || ( aa->aa_flags & AFA_PROBING )) {
425         m_freem( m );
426         return;
427     }
428
429     bcopy(( caddr_t )ea->aarp_sha, ( caddr_t )ea->aarp_tha,
430             sizeof( ea->aarp_sha ));
431     bcopy(( caddr_t )ac->ac_enaddr, ( caddr_t )ea->aarp_sha,
432             sizeof( ea->aarp_sha ));
433
434     /* XXX */
435     eh = (struct ether_header *)sa.sa_data;
436     bcopy(( caddr_t )ea->aarp_tha, ( caddr_t )eh->ether_dhost,
437             sizeof( eh->ether_dhost ));
438
439     if ( aa->aa_flags & AFA_PHASE2 ) {
440         eh->ether_type = htons( sizeof( struct llc ) +
441                 sizeof( struct ether_aarp ));
442         M_PREPEND( m, sizeof( struct llc ), MB_DONTWAIT );
443         if ( m == NULL ) {
444             return;
445         }
446         llc = mtod( m, struct llc *);
447         llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
448         llc->llc_control = LLC_UI;
449         bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
450         llc->llc_ether_type = htons( ETHERTYPE_AARP );
451
452         bcopy( ea->aarp_spnet, ea->aarp_tpnet, sizeof( ea->aarp_tpnet ));
453         bcopy( &ma.s_net, ea->aarp_spnet, sizeof( ea->aarp_spnet ));
454     } else {
455         eh->ether_type = htons( ETHERTYPE_AARP );
456     }
457
458     ea->aarp_tpnode = ea->aarp_spnode;
459     ea->aarp_spnode = ma.s_node;
460     ea->aarp_op = htons( AARPOP_RESPONSE );
461
462     sa.sa_len = sizeof( struct sockaddr );
463     sa.sa_family = AF_UNSPEC;
464     (*ac->ac_if.if_output)( &ac->ac_if, m, &sa, NULL); /* XXX */
465     return;
466 }
467
468 static void
469 aarptfree( struct aarptab *aat)
470 {
471
472     if ( aat->aat_hold )
473         m_freem( aat->aat_hold );
474     aat->aat_hold = NULL;
475     aat->aat_timer = aat->aat_flags = 0;
476     aat->aat_ataddr.s_net = 0;
477     aat->aat_ataddr.s_node = 0;
478 }
479
480     struct aarptab *
481 aarptnew( addr )
482     struct at_addr      *addr;
483 {
484     int                 n;
485     int                 oldest = -1;
486     struct aarptab      *aat, *aato = NULL;
487     static int          first = 1;
488
489     if ( first ) {
490         first = 0;
491         aarptimer_ch = timeout( aarptimer, (caddr_t)0, hz );
492     }
493     aat = &aarptab[ AARPTAB_HASH( *addr ) * AARPTAB_BSIZ ];
494     for ( n = 0; n < AARPTAB_BSIZ; n++, aat++ ) {
495         if ( aat->aat_flags == 0 )
496             goto out;
497         if ( aat->aat_flags & ATF_PERM )
498             continue;
499         if ((int) aat->aat_timer > oldest ) {
500             oldest = aat->aat_timer;
501             aato = aat;
502         }
503     }
504     if ( aato == NULL )
505         return( NULL );
506     aat = aato;
507     aarptfree( aat );
508 out:
509     aat->aat_ataddr = *addr;
510     aat->aat_flags = ATF_INUSE;
511     return( aat );
512 }
513
514
515 void
516 aarpprobe( void *arg )
517 {
518     struct arpcom       *ac = arg;
519     struct mbuf         *m;
520     struct ether_header *eh;
521     struct ether_aarp   *ea;
522     struct at_ifaddr    *aa;
523     struct llc          *llc;
524     struct sockaddr     sa;
525
526     /*
527      * We need to check whether the output ethernet type should
528      * be phase 1 or 2. We have the interface that we'll be sending
529      * the aarp out. We need to find an AppleTalk network on that
530      * interface with the same address as we're looking for. If the
531      * net is phase 2, generate an 802.2 and SNAP header.
532      */
533     for (aa = (struct at_ifaddr *)ac->ac_if.if_addrhead.tqh_first; aa;
534             aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) {
535         if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
536                 ( aa->aa_flags & AFA_PROBING )) {
537             break;
538         }
539     }
540     if ( aa == NULL ) {         /* serious error XXX */
541         printf( "aarpprobe why did this happen?!\n" );
542         return;
543     }
544
545     if ( aa->aa_probcnt <= 0 ) {
546         aa->aa_flags &= ~AFA_PROBING;
547         wakeup( aa );
548         return;
549     } else {
550         aa->aa_ch = timeout( aarpprobe, (caddr_t)ac, hz / 5 );
551     }
552
553     if (( m = m_gethdr( MB_DONTWAIT, MT_DATA )) == NULL ) {
554         return;
555     }
556     m->m_len = sizeof( *ea );
557     m->m_pkthdr.len = sizeof( *ea );
558     MH_ALIGN( m, sizeof( *ea ));
559
560     ea = mtod( m, struct ether_aarp *);
561     bzero((caddr_t)ea, sizeof( *ea ));
562
563     ea->aarp_hrd = htons( AARPHRD_ETHER );
564     ea->aarp_pro = htons( ETHERTYPE_AT );
565     ea->aarp_hln = sizeof( ea->aarp_sha );
566     ea->aarp_pln = sizeof( ea->aarp_spu );
567     ea->aarp_op = htons( AARPOP_PROBE );
568     bcopy((caddr_t)ac->ac_enaddr, (caddr_t)ea->aarp_sha,
569             sizeof( ea->aarp_sha ));
570
571     eh = (struct ether_header *)sa.sa_data;
572
573     if ( aa->aa_flags & AFA_PHASE2 ) {
574         bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
575                 sizeof( eh->ether_dhost ));
576         eh->ether_type = htons( sizeof( struct llc ) +
577                 sizeof( struct ether_aarp ));
578         M_PREPEND( m, sizeof( struct llc ), MB_WAIT );
579         /* XXX-MBUF */
580         llc = mtod( m, struct llc *);
581         llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
582         llc->llc_control = LLC_UI;
583         bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
584         llc->llc_ether_type = htons( ETHERTYPE_AARP );
585
586         bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
587                 sizeof( ea->aarp_spnet ));
588         bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_tpnet,
589                 sizeof( ea->aarp_tpnet ));
590         ea->aarp_spnode = ea->aarp_tpnode = AA_SAT( aa )->sat_addr.s_node;
591     } else {
592         bcopy(ac->ac_if.if_broadcastaddr, eh->ether_dhost,
593               ac->ac_if.if_addrlen);
594         eh->ether_type = htons( ETHERTYPE_AARP );
595         ea->aarp_spa = ea->aarp_tpa = AA_SAT( aa )->sat_addr.s_node;
596     }
597
598 #ifdef NETATALKDEBUG
599     printf("aarp: sending probe for %u.%u\n",
600            ntohs(AA_SAT( aa )->sat_addr.s_net),
601            AA_SAT( aa )->sat_addr.s_node);
602 #endif /* NETATALKDEBUG */
603
604     sa.sa_len = sizeof( struct sockaddr );
605     sa.sa_family = AF_UNSPEC;
606     (*ac->ac_if.if_output)(&ac->ac_if, m, &sa, NULL); /* XXX */
607     aa->aa_probcnt--;
608 }
609
610 void
611 aarp_clean(void)
612 {
613     struct aarptab      *aat;
614     int                 i;
615
616     untimeout( aarptimer, 0, aarptimer_ch );
617     for ( i = 0, aat = aarptab; i < AARPTAB_SIZE; i++, aat++ ) {
618         if ( aat->aat_hold ) {
619             m_freem( aat->aat_hold );
620             aat->aat_hold = NULL;
621         }
622     }
623 }