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 111888 2003-03-04 23:19:55Z jlemon $ |
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/route.h> 22 23#include <netatalk/at.h> 24#include <netatalk/at_var.h> 25#include <netatalk/ddp.h> 26#include <netatalk/ddp_var.h> 27#include <netatalk/at_extern.h> 28 29static volatile int ddp_forward = 1; 30static volatile int ddp_firewall = 0; 31static struct ddpstat ddpstat; 32static struct route forwro; 33 34static void ddp_input(struct mbuf *, struct ifnet *, struct elaphdr *, int); 35 36/* 37 * Could probably merge these two code segments a little better... 38 */ |
39void 40at2intr(struct mbuf *m) |
41{ |
42 |
43 /* 44 * Phase 2 packet handling 45 */ 46 ddp_input(m, m->m_pkthdr.rcvif, NULL, 2); 47 return; 48} |
49 |
50void 51at1intr(struct mbuf *m) 52{ 53 struct elaphdr *elhp, elh; |
54 |
55 /* 56 * Phase 1 packet handling 57 */ 58 if (m->m_len < SZ_ELAPHDR && ((m = m_pullup(m, SZ_ELAPHDR)) == 0)) { 59 ddpstat.ddps_tooshort++; 60 return; |
61 } 62 |
63 /* |
64 * This seems a little dubious, but I don't know phase 1 so leave it. |
65 */ |
66 elhp = mtod(m, struct elaphdr *); 67 m_adj(m, SZ_ELAPHDR); |
68 |
69 if (elhp->el_type == ELAP_DDPEXTEND) { 70 ddp_input(m, m->m_pkthdr.rcvif, NULL, 1); |
71 } else { |
72 bcopy((caddr_t)elhp, (caddr_t)&elh, SZ_ELAPHDR); 73 ddp_input(m, m->m_pkthdr.rcvif, &elh, 1); |
74 } |
75 return; |
76} 77 78static void |
79ddp_input( m, ifp, elh, phase ) 80 struct mbuf *m; 81 struct ifnet *ifp; 82 struct elaphdr *elh; 83 int phase; 84{ 85 struct sockaddr_at from, to; 86 struct ddpshdr *dsh, ddps; --- 364 unchanged lines hidden --- |