Subject: Re: sctp_bindx

From: "La Monte H.P. Yarroll" <[email-masked]>
Date: Tue, 08 Jun 2004 17:07:41 -0400

Ryan W. Bickhart wrote:

>Hello!
>
>I'm not sure if anyone else has experienced this problem, but I am
>currently having trouble with sctp_bindx. Specifically, if I try to bind
>any number of addresses (so far I have tried both a single address and
>two at a time), bindx fails with the error message "Address family not
>supported by protocol family". Below is a small program that causes the
>error. The system being used is FreeBSD 4.9 using the March 31 KAME
>snapshot with SCTP patch 20 applied.
>  
>

That error message generally means that SCTP is not turned on.  I don't
know how FreeBSD kernel configuration works, but in Linux, we have a
compile-time config option to set to add SCTP support.  I would expect
something similar with FreeBSD.  You could also see the same message
if the SCTP kernel module was not loaded--again this is Linux advice,
but it seems likely there will be analogous issues with FreeBSD.

>If you have any insight or suggestions they would be most appreciated.
>
>Thanks!
>
>Ryan
>
>Sample code:
>
>#include <sys/types.h>
>#include <sys/socket.h>
>#include <netinet/in.h>
>#include <arpa/inet.h>
>#include <netinet/sctp.h>
>#include <errno.h>
>#include <stdio.h>
>
>#define LISTEN_ADDRS 2
>#define LISTEN_PORT 3333
>
>int main(int argc, char *argv[]) {
>
>   int sock_fd = 0;
>   int i = 0;
>   struct sockaddr_in listen_addrs[LISTEN_ADDRS];
>
>   if(--argc != LISTEN_ADDRS) {
>      printf("Usage: %s <addrs>\n", argv[0]);
>      exit(1);
>   }
>   
>   if((sock_fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) < 0) {
>      perror("socket");
>      exit(1);
>   }
>   
>   for(i = 0; i < LISTEN_ADDRS; i++) {
>      bzero(&listen_addrs[i], sizeof(struct sockaddr_in));
>      listen_addrs[i].sin_family = AF_INET;
>      inet_pton(AF_INET, argv[i + 1], &listen_addrs[i].sin_addr);
>      listen_addrs[i].sin_port = htons(LISTEN_PORT);
>   }
>   
>   printf("Binding the following:\n");
>   
>   for(i = 0; i < LISTEN_ADDRS; i++) {
>      printf("Address: %s, ", inet_ntoa(listen_addrs[i].sin_addr));
>      printf("Port: %d\n", ntohs(listen_addrs[i].sin_port));
>   }
>	
>   if(sctp_bindx(sock_fd, (struct sockaddr *) listen_addrs, LISTEN_ADDRS, SCTP_BINDX_ADD_ADDR) == -1) {
>      perror("sctp_bindx");
>      exit(1);
>   }
>}
>
>
>
>  
>

-- 
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell's sig