Esempio n. 1
0
/* Add a range of numeric ports from min to max, inclusive */
static void
add_ports_range(struct datapath *dp, int min_port, int max_port)
{
    char port_name[16];
    int port;
    int error;

    for (port = min_port; port <= max_port; port++) {
        sprintf(port_name, "%d", port);
        error = dp_add_port(dp, port_name, num_queues);
        if (error) {
            ofp_fatal(error, "failed to add port %s", port_name);
        }
    }
}
Esempio n. 2
0
static void
add_ports(struct datapath *dp, char *port_list)
{
    char *port, *save_ptr;

    /* Glibc 2.7 has a bug in strtok_r when compiling with optimization that
     * can cause segfaults here:
     * http://sources.redhat.com/bugzilla/show_bug.cgi?id=5614.
     * Using ",," instead of the obvious "," works around it. */
    for (port = strtok_r(port_list, ",,", &save_ptr); port;
         port = strtok_r(NULL, ",,", &save_ptr)) {
        int error = dp_add_port(dp, port, num_queues);
        if (error) {
            ofp_fatal(error, "failed to add port %s", port);
        }
    }
}