[ipxe-devel] udp padding in udp_demux()

Wissam Shoukair wissams at mellanox.com
Mon Sep 15 11:55:42 UTC 2014


Hi all,
What is the purpose of the padding in this function?

static struct udp_connection * udp_demux ( struct sockaddr_tcpip *local ) {
                static const struct sockaddr_tcpip empty_sockaddr = { .pad = { 0, } };
                struct udp_connection *udp;

                list_for_each_entry ( udp, &udp_conns, list ) {
                                if ( ( ( udp->local.st_family == local->st_family ) ||
                                       ( udp->local.st_family == 0 ) ) &&
                                     ( ( udp->local.st_port == local->st_port ) ||
                                       ( udp->local.st_port == 0 ) ) &&
                                     ( ( memcmp ( udp->local.pad, local->pad,
                                                                  sizeof ( udp->local.pad ) ) == 0 ) ||
                                       ( memcmp ( udp->local.pad, empty_sockaddr.pad,
                                                                  sizeof ( udp->local.pad ) ) == 0 ) ) ) {
                                                return udp;
                                }
                }
                return NULL;
}

What is the purpose of these checks in the expression?
     ( ( memcmp ( udp->local.pad, local->pad,
                                 sizeof ( udp->local.pad ) ) == 0 ) ||
       ( memcmp ( udp->local.pad, empty_sockaddr.pad,
                                  sizeof ( udp->local.pad ) ) == 0 ) ) ) {



Thanks,
Wissam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20140915/14f71347/attachment.htm>


More information about the ipxe-devel mailing list