diff options
author | fjoe <fjoe@FreeBSD.org> | 2003-01-30 15:55:02 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2003-01-30 15:55:02 +0000 |
commit | 8bfc65ceab6068576f9a219ef35ae128b2501c6c (patch) | |
tree | 15b17f4f4463a8f35b0318e32c1d048c045660c0 /sys/net | |
parent | aca5ef0c28f0a805ba7394f5539685592b4aed62 (diff) | |
download | FreeBSD-src-8bfc65ceab6068576f9a219ef35ae128b2501c6c.zip FreeBSD-src-8bfc65ceab6068576f9a219ef35ae128b2501c6c.tar.gz |
- bpf is now working (tested with tcpdump)
- fix promiscious mode
MFC after: 3 days
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_arcsubr.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 1fc68c3..562149f 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -89,6 +89,8 @@ static int arc_resolvemulti(struct ifnet *, struct sockaddr **, u_int8_t arcbroadcastaddr = 0; +#define ARC_LLADDR(ifp) (*(u_int8_t *)IF_LLADDR(ifp)) + #define senderr(e) { error = (e); goto bad;} #define SIN(s) ((struct sockaddr_in *)s) #define SIPX(s) ((struct sockaddr_ipx *)s) @@ -111,6 +113,7 @@ arc_output(ifp, m, dst, rt0) int error; u_int8_t atype, adst; int loop_copy = 0; + int isphds; if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) return(ENETDOWN); /* m, m1 aren't initialized yet */ @@ -208,13 +211,18 @@ arc_output(ifp, m, dst, rt0) senderr(EAFNOSUPPORT); } - M_PREPEND(m, ARC_HDRLEN, M_NOWAIT); + isphds = arc_isphds(atype); + M_PREPEND(m, isphds ? ARC_HDRNEWLEN : ARC_HDRLEN, M_NOWAIT); if (m == 0) senderr(ENOBUFS); ah = mtod(m, struct arc_header *); ah->arc_type = atype; ah->arc_dhost = adst; - ah->arc_shost = *IF_LLADDR(ifp); + ah->arc_shost = ARC_LLADDR(ifp); + if (isphds) { + ah->arc_flag = 0; + ah->arc_seqid = 0; + } if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) { if ((m->m_flags & M_BCAST) || (loop_copy > 0)) { @@ -282,7 +290,7 @@ arc_frag_next(ifp) ac->arc_shost = ah->arc_shost; ac->arc_type = ah->arc_type; - m_adj(m, ARC_HDRLEN); + m_adj(m, ARC_HDRNEWLEN); ac->curr_frag = m; } @@ -535,9 +543,9 @@ arc_input(ifp, m) ah = mtod(m, struct arc_header *); /* does this belong to us? */ - if ((ifp->if_flags & IFF_PROMISC) != 0 + if ((ifp->if_flags & IFF_PROMISC) == 0 && ah->arc_dhost != arcbroadcastaddr - && ah->arc_dhost != *IF_LLADDR(ifp)) { + && ah->arc_dhost != ARC_LLADDR(ifp)) { m_freem(m); return; } @@ -626,7 +634,7 @@ arc_storelladdr(ifp, lla) struct ifnet *ifp; u_int8_t lla; { - *IF_LLADDR(ifp) = lla; + ARC_LLADDR(ifp) = lla; } /* @@ -713,7 +721,7 @@ arc_ioctl(ifp, command, data) struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr); if (ipx_nullhost(*ina)) - ina->x_host.c_host[5] = *IF_LLADDR(ifp); + ina->x_host.c_host[5] = ARC_LLADDR(ifp); else arc_storelladdr(ifp, ina->x_host.c_host[5]); @@ -735,8 +743,7 @@ arc_ioctl(ifp, command, data) struct sockaddr *sa; sa = (struct sockaddr *) &ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, ARC_ADDR_LEN); + *(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp); } break; |