aboutsummaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2007-10-24 21:15:54 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2007-10-24 21:15:54 +0000
commit6973ae63bd9d7b2de13849a68a798fe20d51ff60 (patch)
tree5fdfbbeb17af58fadd6fbd57e06ec072025d78f7 /sys/net
parent5f3882d1007023dfb60777cc7cfd696b67952de8 (diff)
Notes
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index be2cb0e8139f..47bea0493aba 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -93,7 +93,7 @@ static void bpf_attachd(struct bpf_d *, struct bpf_if *);
static void bpf_detachd(struct bpf_d *);
static void bpf_freed(struct bpf_d *);
static void bpf_mcopy(const void *, void *, size_t);
-static int bpf_movein(struct uio *, int, int,
+static int bpf_movein(struct uio *, int, struct ifnet *,
struct mbuf **, struct sockaddr *, struct bpf_insn *);
static int bpf_setif(struct bpf_d *, struct ifreq *);
static void bpf_timed_out(void *);
@@ -153,9 +153,10 @@ static struct filterops bpfread_filtops =
{ 1, NULL, filt_bpfdetach, filt_bpfread };
static int
-bpf_movein(struct uio *uio, int linktype, int mtu, struct mbuf **mp,
+bpf_movein(struct uio *uio, int linktype, struct ifnet *ifp, struct mbuf **mp,
struct sockaddr *sockp, struct bpf_insn *wfilter)
{
+ struct ether_header *eh;
struct mbuf *m;
int error;
int len;
@@ -224,7 +225,7 @@ bpf_movein(struct uio *uio, int linktype, int mtu, struct mbuf **mp,
len = uio->uio_resid;
- if (len - hlen > mtu)
+ if (len - hlen > ifp->if_mtu)
return (EMSGSIZE);
if ((unsigned)len > MCLBYTES)
@@ -256,6 +257,20 @@ bpf_movein(struct uio *uio, int linktype, int mtu, struct mbuf **mp,
goto bad;
}
+ /* Check for multicast destination */
+ switch (linktype) {
+ case DLT_EN10MB:
+ eh = mtod(m, struct ether_header *);
+ if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
+ if (bcmp(ifp->if_broadcastaddr, eh->ether_dhost,
+ ETHER_ADDR_LEN) == 0)
+ m->m_flags |= M_BCAST;
+ else
+ m->m_flags |= M_MCAST;
+ }
+ break;
+ }
+
/*
* Make room for link header, and copy it to sockaddr
*/
@@ -586,7 +601,7 @@ bpfwrite(struct cdev *dev, struct uio *uio, int ioflag)
return (0);
bzero(&dst, sizeof(dst));
- error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp->if_mtu,
+ error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp,
&m, &dst, d->bd_wfilter);
if (error)
return (error);