Deleted Added
sdiff udiff text old ( 101937 ) new ( 111888 )
full compact
1/*
2 * Copyright (c) 1990,1994 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
4 *
5 * $FreeBSD: head/sys/netatalk/ddp_input.c 101937 2002-08-15 18:58:44Z rwatson $
6 */
7
8#include "opt_mac.h"
9
10#include <sys/param.h>
11#include <sys/kernel.h>
12#include <sys/lock.h>
13#include <sys/mac.h>
14#include <sys/mbuf.h>
15#include <sys/signalvar.h>
16#include <sys/socket.h>
17#include <sys/socketvar.h>
18#include <sys/sx.h>
19#include <sys/systm.h>
20#include <net/if.h>
21#include <net/intrq.h>
22#include <net/netisr.h>
23#include <net/route.h>
24
25#include <netatalk/at.h>
26#include <netatalk/at_var.h>
27#include <netatalk/ddp.h>
28#include <netatalk/ddp_var.h>
29#include <netatalk/at_extern.h>
30
31static volatile int ddp_forward = 1;
32static volatile int ddp_firewall = 0;
33static struct ddpstat ddpstat;
34static struct route forwro;
35
36static void ddp_input(struct mbuf *, struct ifnet *, struct elaphdr *, int);
37
38/*
39 * Could probably merge these two code segments a little better...
40 */
41static void
42atintr( void )
43{
44 struct elaphdr *elhp, elh;
45 struct ifnet *ifp;
46 struct mbuf *m;
47 int s;
48
49 /*
50 * First pull off all the phase 2 packets.
51 */
52 for (;;) {
53 s = splimp();
54
55 IF_DEQUEUE( &atintrq2, m );
56
57 splx( s );
58
59 if ( m == 0 ) { /* no more queued packets */
60 break;
61 }
62
63 ifp = m->m_pkthdr.rcvif;
64 ddp_input( m, ifp, (struct elaphdr *)NULL, 2 );
65 }
66
67 /*
68 * Then pull off all the phase 1 packets.
69 */
70 for (;;) {
71 s = splimp();
72
73 IF_DEQUEUE( &atintrq1, m );
74
75 splx( s );
76
77 if ( m == 0 ) { /* no more queued packets */
78 break;
79 }
80
81 ifp = m->m_pkthdr.rcvif;
82
83 if ( m->m_len < SZ_ELAPHDR &&
84 (( m = m_pullup( m, SZ_ELAPHDR )) == 0 )) {
85 ddpstat.ddps_tooshort++;
86 continue;
87 }
88
89 /*
90 * this seems a little dubios, but I don't know phase 1 so leave it.
91 */
92 elhp = mtod( m, struct elaphdr *);
93 m_adj( m, SZ_ELAPHDR );
94
95 if ( elhp->el_type == ELAP_DDPEXTEND ) {
96 ddp_input( m, ifp, (struct elaphdr *)NULL, 1 );
97 } else {
98 bcopy((caddr_t)elhp, (caddr_t)&elh, SZ_ELAPHDR );
99 ddp_input( m, ifp, &elh, 1 );
100 }
101 }
102 return;
103}
104
105static void
106netisr_atalk_setup(void *dummy __unused)
107{
108
109 register_netisr(NETISR_ATALK, atintr);
110}
111SYSINIT(atalk_setup, SI_SUB_CPU, SI_ORDER_ANY, netisr_atalk_setup, NULL);
112
113static void
114ddp_input( m, ifp, elh, phase )
115 struct mbuf *m;
116 struct ifnet *ifp;
117 struct elaphdr *elh;
118 int phase;
119{
120 struct sockaddr_at from, to;
121 struct ddpshdr *dsh, ddps;

--- 364 unchanged lines hidden ---