src/tcpkali_iface.c
static int
check_if_bindable_ip(struct sockaddr_storage *ss) {
    int rc;
    int lsock = socket(ss->ss_family, SOCK_STREAM, IPPROTO_TCP);
    assert(lsock != -1);
    rc = bind(lsock, (struct sockaddr *)ss, sockaddr_len(ss));
    close(lsock);
    if(rc == -1) {
        char buf[256];
        fprintf(stderr, "%s is not local: %s\n",
                format_sockaddr(ss, buf, sizeof(buf)), strerror(errno));
        return -1;
    }
    return 0;
}
/*
 * Check whether we can bind to a specified IP.
 */
Check whether we can bind to a specified IP.
Check whether we can bind to a specified IP .
static int
check_if_bindable_ip(struct sockaddr_storage *ss) {
    int rc;
    int lsock = socket(ss->ss_family, SOCK_STREAM, IPPROTO_TCP);
    assert(lsock != -1);
    rc = bind(lsock, (struct sockaddr *)ss, sockaddr_len(ss));
    close(lsock);
    if(rc == -1) {
        char buf[256];
        fprintf(stderr, "%s is not local: %s\n",
                format_sockaddr(ss, buf, sizeof(buf)), strerror(errno));
        return -1;
    }
    return 0;
}
static int check_if_bindable_ip ( struct sockaddr_storage * ss ) { int rc ; int lsock = socket ( ss -> ss_family , SOCK_STREAM , IPPROTO_TCP ) ; assert ( lsock != -1 ) ; rc = bind ( lsock , ( struct sockaddr * ) ss , sockaddr_len ( ss ) ) ; close ( lsock ) ; if ( rc == -1 ) { char buf [ 256 ] ; fprintf ( stderr , " \n " , format_sockaddr ( ss , buf , sizeof ( buf ) ) , strerror ( errno ) ) ; return -1 ; } return 0 ; }
Check whether we can bind to a specified IP.
Check whether we can bind to a specified IP .