diff options
author | msmith <msmith@FreeBSD.org> | 1999-10-15 05:07:00 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-10-15 05:07:00 +0000 |
commit | 010a32d6458bd7e412e002c28e3878b4705e31d4 (patch) | |
tree | c7ec9ce93e079a077a5d74249290ab77984e574c /sys/net/if_ethersubr.c | |
parent | d21234b78cc7e611247dffae6bf6c15ac69b667a (diff) | |
download | FreeBSD-src-010a32d6458bd7e412e002c28e3878b4705e31d4.zip FreeBSD-src-010a32d6458bd7e412e002c28e3878b4705e31d4.tar.gz |
Implement pseudo_AF_HDRCMPLT, which controls the state of the 'header
completion' flag. If set, the interface output routine will assume that
the packet already has a valid link-level source address. This defaults
to off (the address is overwritten)
PR: kern/10680
Submitted by: "Christopher N . Harrell" <cnh@mindspring.net>
Obtained from: NetBSD
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r-- | sys/net/if_ethersubr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 489bcb2..9d59287 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -132,8 +132,8 @@ ether_output(ifp, m0, dst, rt0) struct rtentry *rt0; { short type; - int s, error = 0; - u_char edst[6]; + int s, error = 0, hdrcmplt = 0; + u_char esrc[6], edst[6]; register struct mbuf *m = m0; register struct rtentry *rt; register struct ether_header *eh; @@ -326,6 +326,12 @@ ether_output(ifp, m0, dst, rt0) } break; #endif /* LLC */ + case pseudo_AF_HDRCMPLT: + hdrcmplt = 1; + eh = (struct ether_header *)dst->sa_data; + (void)memcpy(esrc, eh->ether_shost, sizeof (esrc)); + /* FALLTHROUGH */ + case AF_UNSPEC: loop_copy = -1; /* if this is for us, don't do it */ eh = (struct ether_header *)dst->sa_data; @@ -350,8 +356,12 @@ ether_output(ifp, m0, dst, rt0) (void)memcpy(&eh->ether_type, &type, sizeof(eh->ether_type)); (void)memcpy(eh->ether_dhost, edst, sizeof (edst)); - (void)memcpy(eh->ether_shost, ac->ac_enaddr, - sizeof(eh->ether_shost)); + if (hdrcmplt) + (void)memcpy(eh->ether_shost, esrc, + sizeof(eh->ether_shost)); + else + (void)memcpy(eh->ether_shost, ac->ac_enaddr, + sizeof(eh->ether_shost)); /* * If a simplex interface, and the packet is being sent to our |