From 436d222fff66862036635a637b0d9471f02faaf3 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 3 May 2013 05:59:54 +0000 Subject: [PATCH] Fix bug: unset bits properly --- libnetutil/IPv4Header.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libnetutil/IPv4Header.cc b/libnetutil/IPv4Header.cc index 1891fbd7f..7c8f84c03 100644 --- a/libnetutil/IPv4Header.cc +++ b/libnetutil/IPv4Header.cc @@ -370,7 +370,7 @@ int IPv4Header::setRF(){ /** Unset RF flag */ int IPv4Header::unsetRF(){ - h.ip_off ^= htons(IP_RF); + h.ip_off = h.ip_off & ~(htons(IP_RF)); return OP_SUCCESS; } /* End of unsetRF() */ @@ -390,7 +390,7 @@ int IPv4Header::setMF(){ /** Unset MF flag */ int IPv4Header::unsetMF(){ - h.ip_off ^= htons(IP_MF); + h.ip_off = h.ip_off & ~(htons(IP_MF)); return OP_SUCCESS; } /* End of unsetMF() */ @@ -410,7 +410,7 @@ int IPv4Header::setDF(){ /** Unset DF flag */ int IPv4Header::unsetDF(){ - h.ip_off ^= htons(IP_DF); + h.ip_off = h.ip_off & ~(htons(IP_DF)); return OP_SUCCESS; } /* End of unsetDF() */