Deleted Added
full compact
if_ether.c (44078) if_ether.c (44165)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_ether.c 8.1 (Berkeley) 6/10/93
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)if_ether.c 8.1 (Berkeley) 6/10/93
34 * $Id: if_ether.c,v 1.52 1999/01/19 23:17:03 fenner Exp $
34 * $Id: if_ether.c,v 1.53 1999/02/16 10:49:51 dfr Exp $
35 */
36
37/*
38 * Ethernet address resolution protocol.
39 * TODO:
40 * add "inuse/lock" bit (or ref. count) along with valid bit
41 */
42

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

50#include <sys/systm.h>
51#include <sys/mbuf.h>
52#include <sys/malloc.h>
53#include <sys/socket.h>
54#include <sys/syslog.h>
55
56#include <net/if.h>
57#include <net/if_dl.h>
35 */
36
37/*
38 * Ethernet address resolution protocol.
39 * TODO:
40 * add "inuse/lock" bit (or ref. count) along with valid bit
41 */
42

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

50#include <sys/systm.h>
51#include <sys/mbuf.h>
52#include <sys/malloc.h>
53#include <sys/socket.h>
54#include <sys/syslog.h>
55
56#include <net/if.h>
57#include <net/if_dl.h>
58#include <net/if_types.h>
58#include <net/route.h>
59#include <net/netisr.h>
60
61#include <netinet/in.h>
62#include <netinet/in_var.h>
63#include <netinet/if_ether.h>
64
65#define SIN(s) ((struct sockaddr_in *)s)

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

292 m->m_len = sizeof(*ea);
293 m->m_pkthdr.len = sizeof(*ea);
294 MH_ALIGN(m, sizeof(*ea));
295 ea = mtod(m, struct ether_arp *);
296 eh = (struct ether_header *)sa.sa_data;
297 bzero((caddr_t)ea, sizeof (*ea));
298 (void)memcpy(eh->ether_dhost, etherbroadcastaddr, sizeof(eh->ether_dhost));
299 eh->ether_type = htons(ETHERTYPE_ARP); /* if_output will not swap */
59#include <net/route.h>
60#include <net/netisr.h>
61
62#include <netinet/in.h>
63#include <netinet/in_var.h>
64#include <netinet/if_ether.h>
65
66#define SIN(s) ((struct sockaddr_in *)s)

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

293 m->m_len = sizeof(*ea);
294 m->m_pkthdr.len = sizeof(*ea);
295 MH_ALIGN(m, sizeof(*ea));
296 ea = mtod(m, struct ether_arp *);
297 eh = (struct ether_header *)sa.sa_data;
298 bzero((caddr_t)ea, sizeof (*ea));
299 (void)memcpy(eh->ether_dhost, etherbroadcastaddr, sizeof(eh->ether_dhost));
300 eh->ether_type = htons(ETHERTYPE_ARP); /* if_output will not swap */
300 ea->arp_hrd = htons(ARPHRD_ETHER);
301 if (ac->ac_if.if_type == IFT_ETHER)
302 ea->arp_hrd = htons(ARPHRD_ETHER);
303 if (ac->ac_if.if_type == IFT_ISO88025)
304 ea->arp_hrd = htons(ARPHRD_IEEE802);
301 ea->arp_pro = htons(ETHERTYPE_IP);
302 ea->arp_hln = sizeof(ea->arp_sha); /* hardware address length */
303 ea->arp_pln = sizeof(ea->arp_spa); /* protocol address length */
304 ea->arp_op = htons(ARPOP_REQUEST);
305 (void)memcpy(ea->arp_sha, enaddr, sizeof(ea->arp_sha));
306 (void)memcpy(ea->arp_spa, sip, sizeof(ea->arp_spa));
307 (void)memcpy(ea->arp_tpa, tip, sizeof(ea->arp_tpa));
308 sa.sa_family = AF_UNSPEC;

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

405 while (arpintrq.ifq_head) {
406 s = splimp();
407 IF_DEQUEUE(&arpintrq, m);
408 splx(s);
409 if (m == 0 || (m->m_flags & M_PKTHDR) == 0)
410 panic("arpintr");
411 if (m->m_len >= sizeof(struct arphdr) &&
412 (ar = mtod(m, struct arphdr *)) &&
305 ea->arp_pro = htons(ETHERTYPE_IP);
306 ea->arp_hln = sizeof(ea->arp_sha); /* hardware address length */
307 ea->arp_pln = sizeof(ea->arp_spa); /* protocol address length */
308 ea->arp_op = htons(ARPOP_REQUEST);
309 (void)memcpy(ea->arp_sha, enaddr, sizeof(ea->arp_sha));
310 (void)memcpy(ea->arp_spa, sip, sizeof(ea->arp_spa));
311 (void)memcpy(ea->arp_tpa, tip, sizeof(ea->arp_tpa));
312 sa.sa_family = AF_UNSPEC;

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

409 while (arpintrq.ifq_head) {
410 s = splimp();
411 IF_DEQUEUE(&arpintrq, m);
412 splx(s);
413 if (m == 0 || (m->m_flags & M_PKTHDR) == 0)
414 panic("arpintr");
415 if (m->m_len >= sizeof(struct arphdr) &&
416 (ar = mtod(m, struct arphdr *)) &&
413 ntohs(ar->ar_hrd) == ARPHRD_ETHER &&
417 (ntohs(ar->ar_hrd) == ARPHRD_ETHER ||
418 ntohs(ar->ar_hrd) == ARPHRD_IEEE802) &&
414 m->m_len >=
415 sizeof(struct arphdr) + 2 * ar->ar_hln + 2 * ar->ar_pln)
416
417 switch (ntohs(ar->ar_pro)) {
418
419#ifdef INET
420 case ETHERTYPE_IP:
421 in_arpinput(m);

--- 259 unchanged lines hidden ---
419 m->m_len >=
420 sizeof(struct arphdr) + 2 * ar->ar_hln + 2 * ar->ar_pln)
421
422 switch (ntohs(ar->ar_pro)) {
423
424#ifdef INET
425 case ETHERTYPE_IP:
426 in_arpinput(m);

--- 259 unchanged lines hidden ---