*** udp_usrreq.c.virgin Thu Sep 26 22:10:52 1996 --- udp_usrreq.c Thu Sep 26 22:11:30 1996 *************** *** 36,41 **** --- 36,43 ---- #define UDP_PRE_PAD 24 + #include + /* * UDP protocol implementation. * Per RFC 768, August, 1980. *************** *** 52,57 **** --- 54,64 ---- struct inpcb *last_inp; + #ifdef BPF_KERN_FILTER + struct bpf_insn *bpf_udp_filter; + u_long bpf_udp_drops; + #endif + udp_input(m0, ifp) struct mbuf *m0; struct ifnet *ifp; *************** *** 120,128 **** (inp->inp_laddr.s_addr != INADDR_ANY && inp->inp_laddr.s_addr != ui->ui_dst.s_addr) || inp->inp_lport != ui->ui_dport) { ! inp = in_pcblookup(&udb, ! ui->ui_src, ui->ui_sport, ui->ui_dst, ui->ui_dport, ! INPLOOKUP_WILDCARD); last_inp = inp; } --- 127,148 ---- (inp->inp_laddr.s_addr != INADDR_ANY && inp->inp_laddr.s_addr != ui->ui_dst.s_addr) || inp->inp_lport != ui->ui_dport) { ! inp = in_pcblookup(&udb, ui->ui_src, ui->ui_sport, ! ui->ui_dst, ui->ui_dport, INPLOOKUP_WILDCARD); ! #ifdef BPF_KERN_FILTER ! /* ! * If we have a udp filter, run it and pretend we're ! * not listening if it matches. ! */ ! if (bpf_udp_filter != NULL && ! bpf_filter(bpf_udp_filter, (u_char *)ui, len, len) != 0) { ! ++bpf_udp_drops; ! log(LOG_DEBUG | LOG_AUTH, ! "tcp_input: %s bpf rejected to udp port %d", ! inet_ntoa(ui->ui_src), ui->ui_dport); ! inp = NULL; ! } ! #endif last_inp = inp; }