Deleted Added
full compact
aarp.c (101937) aarp.c (109623)
1/*
2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
3 * All Rights Reserved.
4 *
1/*
2 * Copyright (c) 1990,1991 Regents of The University of Michigan.
3 * All Rights Reserved.
4 *
5 * $FreeBSD: head/sys/netatalk/aarp.c 101937 2002-08-15 18:58:44Z rwatson $
5 * $FreeBSD: head/sys/netatalk/aarp.c 109623 2003-01-21 08:56:16Z alfred $
6 */
7
8#include "opt_atalk.h"
9#include "opt_mac.h"
10
11#include <sys/param.h>
12#include <sys/systm.h>
13#include <sys/mac.h>

--- 108 unchanged lines hidden (view full) ---

122{
123 struct mbuf *m;
124 struct ether_header *eh;
125 struct ether_aarp *ea;
126 struct at_ifaddr *aa;
127 struct llc *llc;
128 struct sockaddr sa;
129
6 */
7
8#include "opt_atalk.h"
9#include "opt_mac.h"
10
11#include <sys/param.h>
12#include <sys/systm.h>
13#include <sys/mac.h>

--- 108 unchanged lines hidden (view full) ---

122{
123 struct mbuf *m;
124 struct ether_header *eh;
125 struct ether_aarp *ea;
126 struct at_ifaddr *aa;
127 struct llc *llc;
128 struct sockaddr sa;
129
130 if (( m = m_gethdr( M_DONTWAIT, MT_DATA )) == NULL ) {
130 if (( m = m_gethdr( M_NOWAIT, MT_DATA )) == NULL ) {
131 return;
132 }
133#ifdef MAC
134 mac_create_mbuf_linklayer(&ac->ac_if, m);
135#endif
136 m->m_len = sizeof( *ea );
137 m->m_pkthdr.len = sizeof( *ea );
138 MH_ALIGN( m, sizeof( *ea ));

--- 22 unchanged lines hidden (view full) ---

161 }
162
163 eh = (struct ether_header *)sa.sa_data;
164
165 if ( aa->aa_flags & AFA_PHASE2 ) {
166 bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
167 sizeof( eh->ether_dhost ));
168 eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp));
131 return;
132 }
133#ifdef MAC
134 mac_create_mbuf_linklayer(&ac->ac_if, m);
135#endif
136 m->m_len = sizeof( *ea );
137 m->m_pkthdr.len = sizeof( *ea );
138 MH_ALIGN( m, sizeof( *ea ));

--- 22 unchanged lines hidden (view full) ---

161 }
162
163 eh = (struct ether_header *)sa.sa_data;
164
165 if ( aa->aa_flags & AFA_PHASE2 ) {
166 bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
167 sizeof( eh->ether_dhost ));
168 eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp));
169 M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT );
169 M_PREPEND( m, sizeof( struct llc ), 0 );
170 llc = mtod( m, struct llc *);
171 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
172 llc->llc_control = LLC_UI;
173 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
174 llc->llc_ether_type = htons( ETHERTYPE_AARP );
175
176 bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
177 sizeof( ea->aarp_spnet ));

--- 257 unchanged lines hidden (view full) ---

435 /* XXX */
436 eh = (struct ether_header *)sa.sa_data;
437 bcopy(( caddr_t )ea->aarp_tha, ( caddr_t )eh->ether_dhost,
438 sizeof( eh->ether_dhost ));
439
440 if ( aa->aa_flags & AFA_PHASE2 ) {
441 eh->ether_type = htons( sizeof( struct llc ) +
442 sizeof( struct ether_aarp ));
170 llc = mtod( m, struct llc *);
171 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
172 llc->llc_control = LLC_UI;
173 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
174 llc->llc_ether_type = htons( ETHERTYPE_AARP );
175
176 bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
177 sizeof( ea->aarp_spnet ));

--- 257 unchanged lines hidden (view full) ---

435 /* XXX */
436 eh = (struct ether_header *)sa.sa_data;
437 bcopy(( caddr_t )ea->aarp_tha, ( caddr_t )eh->ether_dhost,
438 sizeof( eh->ether_dhost ));
439
440 if ( aa->aa_flags & AFA_PHASE2 ) {
441 eh->ether_type = htons( sizeof( struct llc ) +
442 sizeof( struct ether_aarp ));
443 M_PREPEND( m, sizeof( struct llc ), M_DONTWAIT );
443 M_PREPEND( m, sizeof( struct llc ), M_NOWAIT );
444 if ( m == NULL ) {
445 return;
446 }
447 llc = mtod( m, struct llc *);
448 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
449 llc->llc_control = LLC_UI;
450 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
451 llc->llc_ether_type = htons( ETHERTYPE_AARP );

--- 94 unchanged lines hidden (view full) ---

546 if ( aa->aa_probcnt <= 0 ) {
547 aa->aa_flags &= ~AFA_PROBING;
548 wakeup( aa );
549 return;
550 } else {
551 aa->aa_ch = timeout( aarpprobe, (caddr_t)ac, hz / 5 );
552 }
553
444 if ( m == NULL ) {
445 return;
446 }
447 llc = mtod( m, struct llc *);
448 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
449 llc->llc_control = LLC_UI;
450 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
451 llc->llc_ether_type = htons( ETHERTYPE_AARP );

--- 94 unchanged lines hidden (view full) ---

546 if ( aa->aa_probcnt <= 0 ) {
547 aa->aa_flags &= ~AFA_PROBING;
548 wakeup( aa );
549 return;
550 } else {
551 aa->aa_ch = timeout( aarpprobe, (caddr_t)ac, hz / 5 );
552 }
553
554 if (( m = m_gethdr( M_DONTWAIT, MT_DATA )) == NULL ) {
554 if (( m = m_gethdr( M_NOWAIT, MT_DATA )) == NULL ) {
555 return;
556 }
557#ifdef MAC
558 mac_create_mbuf_linklayer(&ac->ac_if, m);
559#endif
560 m->m_len = sizeof( *ea );
561 m->m_pkthdr.len = sizeof( *ea );
562 MH_ALIGN( m, sizeof( *ea ));

--- 11 unchanged lines hidden (view full) ---

574
575 eh = (struct ether_header *)sa.sa_data;
576
577 if ( aa->aa_flags & AFA_PHASE2 ) {
578 bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
579 sizeof( eh->ether_dhost ));
580 eh->ether_type = htons( sizeof( struct llc ) +
581 sizeof( struct ether_aarp ));
555 return;
556 }
557#ifdef MAC
558 mac_create_mbuf_linklayer(&ac->ac_if, m);
559#endif
560 m->m_len = sizeof( *ea );
561 m->m_pkthdr.len = sizeof( *ea );
562 MH_ALIGN( m, sizeof( *ea ));

--- 11 unchanged lines hidden (view full) ---

574
575 eh = (struct ether_header *)sa.sa_data;
576
577 if ( aa->aa_flags & AFA_PHASE2 ) {
578 bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost,
579 sizeof( eh->ether_dhost ));
580 eh->ether_type = htons( sizeof( struct llc ) +
581 sizeof( struct ether_aarp ));
582 M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT );
582 M_PREPEND( m, sizeof( struct llc ), 0 );
583 llc = mtod( m, struct llc *);
584 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
585 llc->llc_control = LLC_UI;
586 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
587 llc->llc_ether_type = htons( ETHERTYPE_AARP );
588
589 bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
590 sizeof( ea->aarp_spnet ));

--- 36 unchanged lines hidden ---
583 llc = mtod( m, struct llc *);
584 llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
585 llc->llc_control = LLC_UI;
586 bcopy( aarp_org_code, llc->llc_org_code, sizeof( aarp_org_code ));
587 llc->llc_ether_type = htons( ETHERTYPE_AARP );
588
589 bcopy( &AA_SAT( aa )->sat_addr.s_net, ea->aarp_spnet,
590 sizeof( ea->aarp_spnet ));

--- 36 unchanged lines hidden ---