Will send out a V2 with the correct Commit Msg Title. Consider this as an RFC.

On 5/8/18, 10:07 AM, "Sairam Venugopal" <[email protected]> wrote:

    IPFIX templates and flow packets are silently dropped when a corresponding
    ARP entry is missing for the Collector. The fix is to explicitly trigger an
    ARP request before sending UDP packets to the collector.
    
    Making changes in Windows to maintain the destination IP address as part
    of the Collector Structure. Since the SendARP is a blocking call, we do
    not necessarily need to check for a response before sending the IPFIX
    packets. Keeping the fix specific to Windows since this behavior cannot be
    reproduced in Linux.
    
    Reported-at: https://github.com/openvswitch/ovs-issues/issues/147
    Signed-off-by: Sairam Venugopal <[email protected]>
    ---
     ofproto/collectors.c | 25 +++++++++++++++++++++++++
     1 file changed, 25 insertions(+)
    
    diff --git a/ofproto/collectors.c b/ofproto/collectors.c
    index bc92332..239599a 100644
    --- a/ofproto/collectors.c
    +++ b/ofproto/collectors.c
    @@ -27,11 +27,17 @@
     #include "sset.h"
     #include "util.h"
     #include "openvswitch/vlog.h"
    +#ifdef WIN32
    +#include <iphlpapi.h>
    +#endif WIN32
     
     VLOG_DEFINE_THIS_MODULE(collectors);
     
     struct collectors {
         int *fds;                     /* Sockets. */
    +#ifdef WIN32
    +    IPAddr *destIPs;              /* Collector's IP address */
    +#endif WIN32
         size_t n_fds;                 /* Number of sockets. */
     };
     
    @@ -58,6 +64,9 @@ collectors_create(const struct sset *targets, uint16_t 
default_port,
     
         c = xmalloc(sizeof *c);
         c->fds = xmalloc(sizeof *c->fds * sset_count(targets));
    +#ifdef WIN32
    +    c->destIPs = xmalloc(sizeof *c->destIPs * sset_count(targets));
    +#endif
         c->n_fds = 0;
         SSET_FOR_EACH (name, targets) {
             int error;
    @@ -65,6 +74,13 @@ collectors_create(const struct sset *targets, uint16_t 
default_port,
     
             error = inet_open_active(SOCK_DGRAM, name, default_port, NULL, 
&fd, 0);
             if (fd >= 0) {
    +#ifdef WIN32
    +            char *target = xstrdup(name);
    +            char *p;
    +            p = target;
    +            c->destIPs[c->n_fds] = htonl(inet_addr(inet_parse_token(&p)));
    +            free(target);
    +#endif WIN32
                 c->fds[c->n_fds++] = fd;
             } else {
                 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
    @@ -97,6 +113,9 @@ collectors_destroy(struct collectors *c)
             for (i = 0; i < c->n_fds; i++) {
                 closesocket(c->fds[i]);
             }
    +#ifdef WIN32
    +        free(c->destIPs);
    +#endif
             free(c->fds);
             free(c);
         }
    @@ -114,6 +133,12 @@ collectors_send(const struct collectors *c, const void 
*payload, size_t n)
     
             for (i = 0; i < c->n_fds; i++) {
                 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
    +#ifdef WIN32
    +            /* Trigger an ARP request before sending an IPFIX packet */
    +            ULONG MacAddr[2];
    +            ULONG PhysAddrLen = 6;
    +            SendARP(c->destIPs[i], 0, &MacAddr, &PhysAddrLen);
    +#endif
                 if (send(c->fds[i], payload, n, 0) == -1) {
                     char *s = describe_fd(c->fds[i]);
                     VLOG_WARN_RL(&rl, "%s: sending to collector failed (%s)",
    -- 
    2.9.0.windows.1
    
    

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to