Committer: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx> Date: 09/06/2010 at 13:03:30 Revision: 4734 Revision-id: mircea.gherzan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: hipd: conditionally compile packet loss simulation code. In the case of _zero_ packet loss probability, the compiler will figure out a comparison of random(3) against zero and will generate a warning. Modified: M hipd/output.c === modified file 'hipd/output.c' --- hipd/output.c 2010-06-09 09:55:23 +0000 +++ hipd/output.c 2010-06-09 10:00:07 +0000 @@ -1257,11 +1257,13 @@ HIP_IFEL(bind(hip_raw_sock_output, (struct sockaddr *) &src, sa_size), -1, "Binding to raw sock failed\n"); +#if (HIP_SIMULATE_PACKET_LOSS_PROBABILITY > 0) if (HIP_SIMULATE_PACKET_LOSS && HIP_SIMULATE_PACKET_IS_LOST()) { HIP_DEBUG("Packet loss probability: %f\n", ((uint64_t) HIP_SIMULATE_PACKET_LOSS_PROBABILITY * RAND_MAX) / 100.f); HIP_DEBUG("Packet was lost (simulation)\n"); goto out_err; } +#endif /* For some reason, neither sendmsg or send (with bind+connect) * do not seem to work properly. Thus, we use just sendto() */