| 789 | #pragma GCC diagnostic ignored "-Wformat" |
| 790 | #pragma GCC diagnostic ignored "-Wformat-extra-args" |
| 791 | static void |
| 792 | in_arpinput(struct mbuf *m) |
| 793 | { |
| 794 | struct rm_priotracker in_ifa_tracker; |
| 795 | struct arphdr *ah; |
| 796 | struct ifnet *ifp = m->m_pkthdr.rcvif; |
| 797 | struct llentry *la = NULL, *la_tmp; |
| 798 | struct ifaddr *ifa; |
| 799 | struct in_ifaddr *ia; |
| 800 | struct sockaddr sa; |
| 801 | struct in_addr isaddr, itaddr, myaddr; |
| 802 | u_int8_t *enaddr = NULL; |
| 803 | int op; |
| 804 | int bridged = 0, is_bridge = 0; |
| 805 | int carped; |
| 806 | struct sockaddr_in sin; |
| 807 | struct sockaddr *dst; |
| 808 | struct nhop_object *nh; |
| 809 | uint8_t linkhdr[LLE_MAX_LINKHDR]; |
| 810 | struct route ro; |
| 811 | size_t linkhdrsize; |
| 812 | int lladdr_off; |
| 813 | int error; |
| 814 | char addrbuf[INET_ADDRSTRLEN]; |
| 815 | |
| 816 | NET_EPOCH_ASSERT(); |
| 817 | |
| 818 | sin.sin_len = sizeof(struct sockaddr_in); |
| 819 | sin.sin_family = AF_INET; |
| 820 | sin.sin_addr.s_addr = 0; |
| 821 | |
| 822 | if (ifp->if_bridge) |
| 823 | bridged = 1; |
| 824 | if (ifp->if_type == IFT_BRIDGE) |
| 825 | is_bridge = 1; |
| 826 | |
| 827 | /* |
| 828 | * We already have checked that mbuf contains enough contiguous data |
| 829 | * to hold entire arp message according to the arp header. |
| 830 | */ |
| 831 | ah = mtod(m, struct arphdr *); |
| 832 | |
| 833 | /* |
| 834 | * ARP is only for IPv4 so we can reject packets with |
| 835 | * a protocol length not equal to an IPv4 address. |
| 836 | */ |
| 837 | if (ah->ar_pln != sizeof(struct in_addr)) { |
| 838 | ARP_LOG(LOG_NOTICE, "requested protocol length != %zu\n", |
| 839 | sizeof(struct in_addr)); |
| 840 | goto drop; |
| 841 | } |
| 842 | |
| 843 | if (allow_multicast == 0 && ETHER_IS_MULTICAST(ar_sha(ah))) { |
| 844 | ARP_LOG(LOG_NOTICE, "%*D is multicast\n", |
| 845 | ifp->if_addrlen, (u_char *)ar_sha(ah), ":"); |
| 846 | goto drop; |
| 847 | } |
| 848 |
no test coverage detected