if_ether.c (e11b6fa307b49a2a9ba2d0af0d80ddc103c84c10) if_ether.c (478df1d534e9b1ca86261fcef37b46cc7b4c8f17)
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

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

491 * This allowed either end to announce the desire to receive
492 * trailer packets.
493 * We no longer reply to requests for ETHERTYPE_TRAIL protocol either,
494 * but formerly didn't normally send requests.
495 */
496static int log_arp_wrong_iface = 1;
497static int log_arp_movements = 1;
498static int log_arp_permanent_modify = 1;
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

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

491 * This allowed either end to announce the desire to receive
492 * trailer packets.
493 * We no longer reply to requests for ETHERTYPE_TRAIL protocol either,
494 * but formerly didn't normally send requests.
495 */
496static int log_arp_wrong_iface = 1;
497static int log_arp_movements = 1;
498static int log_arp_permanent_modify = 1;
499static int allow_multicast = 0;
499
500SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW,
501 &log_arp_wrong_iface, 0,
502 "log arp packets arriving on the wrong interface");
503SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_movements, CTLFLAG_RW,
504 &log_arp_movements, 0,
505 "log arp replies from MACs different than the one in the cache");
506SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW,
507 &log_arp_permanent_modify, 0,
508 "log arp replies from MACs different than the one in the permanent arp entry");
500
501SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_wrong_iface, CTLFLAG_RW,
502 &log_arp_wrong_iface, 0,
503 "log arp packets arriving on the wrong interface");
504SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_movements, CTLFLAG_RW,
505 &log_arp_movements, 0,
506 "log arp replies from MACs different than the one in the cache");
507SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW,
508 &log_arp_permanent_modify, 0,
509 "log arp replies from MACs different than the one in the permanent arp entry");
510SYSCTL_INT(_net_link_ether_inet, OID_AUTO, allow_multicast, CTLFLAG_RW,
511 &allow_multicast, 0, "accept multicast addresses");
509
512
510
511static void
512in_arpinput(struct mbuf *m)
513{
514 struct arphdr *ah;
515 struct ifnet *ifp = m->m_pkthdr.rcvif;
516 struct llentry *la = NULL;
517 struct rtentry *rt;
518 struct ifaddr *ifa;

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

546 * a protocol length not equal to an IPv4 address.
547 */
548 if (ah->ar_pln != sizeof(struct in_addr)) {
549 log(LOG_NOTICE, "in_arp: requested protocol length != %zu\n",
550 sizeof(struct in_addr));
551 return;
552 }
553
513static void
514in_arpinput(struct mbuf *m)
515{
516 struct arphdr *ah;
517 struct ifnet *ifp = m->m_pkthdr.rcvif;
518 struct llentry *la = NULL;
519 struct rtentry *rt;
520 struct ifaddr *ifa;

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

548 * a protocol length not equal to an IPv4 address.
549 */
550 if (ah->ar_pln != sizeof(struct in_addr)) {
551 log(LOG_NOTICE, "in_arp: requested protocol length != %zu\n",
552 sizeof(struct in_addr));
553 return;
554 }
555
554 if (ETHER_IS_MULTICAST(ar_sha(ah))) {
555 log(LOG_NOTICE, "in_arp: %*D is multicast\n",
556 if (allow_multicast == 0 && ETHER_IS_MULTICAST(ar_sha(ah))) {
557 log(LOG_NOTICE, "arp: %*D is multicast\n",
556 ifp->if_addrlen, (u_char *)ar_sha(ah), ":");
557 return;
558 }
559
560 op = ntohs(ah->ar_op);
561 (void)memcpy(&isaddr, ar_spa(ah), sizeof (isaddr));
562 (void)memcpy(&itaddr, ar_tpa(ah), sizeof (itaddr));
563

--- 357 unchanged lines hidden ---
558 ifp->if_addrlen, (u_char *)ar_sha(ah), ":");
559 return;
560 }
561
562 op = ntohs(ah->ar_op);
563 (void)memcpy(&isaddr, ar_spa(ah), sizeof (isaddr));
564 (void)memcpy(&itaddr, ar_tpa(ah), sizeof (itaddr));
565

--- 357 unchanged lines hidden ---