pud: fix checking of downlink message IP version
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 12:37:23 +0000 (14:37 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 22 Oct 2012 13:02:51 +0000 (15:02 +0200)
Coverity:
CID 739637 (#1 of 1): Logically dead code (DEADCODE)
Execution cannot reach this expression ""false"" inside statement
"pudError(false, "Received w...".

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/pud/src/pud.c

index 11c0e82..b2cf42c 100644 (file)
@@ -215,7 +215,7 @@ static void packetReceivedFromDownlink(int skfd, void *data __attribute__ ((unus
                        }
 
                        ipv6 = getUplinkMessageIPv6(&msg->header);
-                       if (unlikely(ipv6 && (olsr_cnf->ip_version != AF_INET6))) {
+                       if (unlikely(!ipv6 && (olsr_cnf->ip_version == AF_INET6)) || unlikely(ipv6 && (olsr_cnf->ip_version == AF_INET))) {
                                pudError(false, "Received wrong IPv6 status (%s) in %s,"
                                                " ignoring message.", (ipv6 ? "true" : "false"),
                                                __func__);