1) remove useless check of loop_copy - corresponding code was removed in

rev. 1.70 five years ago.
2) convert loop_copy to "non-negative" flag

Approved by:	glebius (mentor)
MFC after:	2 weeks
This commit is contained in:
Oleg Bulyzhin 2005-12-22 12:16:20 +00:00
parent 8cb629a368
commit c54c76cc2f

View File

@ -144,7 +144,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
int error, hdrcmplt = 0;
u_char esrc[ETHER_ADDR_LEN], edst[ETHER_ADDR_LEN];
struct ether_header *eh;
int loop_copy = 0;
int loop_copy = 1;
int hlen; /* link layer header length */
#ifdef MAC
@ -174,7 +174,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
ah = mtod(m, struct arphdr *);
ah->ar_hrd = htons(ARPHRD_ETHER);
loop_copy = -1; /* if this is for us, don't do it */
loop_copy = 0; /* if this is for us, don't do it */
switch(ntohs(ah->ar_op)) {
case ARPOP_REVREQUEST:
@ -255,7 +255,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
/* FALLTHROUGH */
case AF_UNSPEC:
loop_copy = -1; /* if this is for us, don't do it */
loop_copy = 0; /* if this is for us, don't do it */
eh = (struct ether_header *)dst->sa_data;
(void)memcpy(edst, eh->ether_dhost, sizeof (edst));
type = eh->ether_type;
@ -301,7 +301,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
* on the wire). However, we don't do that here for security
* reasons and compatibility with the original behavior.
*/
if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1) &&
if ((ifp->if_flags & IFF_SIMPLEX) && loop_copy &&
m_tag_find(m, PACKET_TAG_PF_ROUTED, NULL) == NULL) {
int csum_flags = 0;
@ -310,7 +310,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
if (m->m_flags & M_BCAST) {
struct mbuf *n;
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {