Error: failed to create socket
Bill Fink
yellowdog-general@lists.terrasoftsolutions.com
Mon Sep 8 17:21:01 2003
On Mon, 08 Sep 2003, Charles Trois wrote:
> le 8/09/03 20:01, yellowdog-general-request@lists.terrasoftsolutions.com à
> yellowdog-general-request@lists.terrasoftsolutions.com a écrit :
>
> > Message: 12
> > Date: Mon, 08 Sep 2003 13:36:02 +0200
> > Subject: Re: Error: failed to create socket
> > From: Charles Trois <charles.trois@wanadoo.fr>
> > To: <yellowdog-general@lists.terrasoftsolutions.com>
> > Cc: Bill Fink <billfink@mindspring.com>
> > Reply-To: yellowdog-general@lists.terrasoftsolutions.com
> >
> > le 7/09/03 20:01, yellowdog-general-request@lists.terrasoftsolutions.com =E0
> > yellowdog-general-request@lists.terrasoftsolutions.com a =E9crit=A0:
> >
> >> =20
> >> Message: 7
> >> Date: Sun, 07 Sep 2003 18:50:40 +0200
> >> Subject:Re: Error: failed to create socket
> >> From: Charles Trois <charles.trois@wanadoo.fr>
> >> To: <yellowdog-general@lists.terrasoftsolutions.com>
> >> Cc: Bill Fink <billfink@mindspring.com>
> >> Reply-To: yellowdog-general@lists.terrasoftsolutions.com
> >> =20
> >> le 6/09/03 19:25, yellowdog-general-request@lists.terrasoftsolutions.com =
> > =3DE0
> >> yellowdog-general-request@lists.terrasoftsolutions.com a =3DE9crit=3DA0:
> >> =20
> >>> Hi Charles,
> >>> =3D20
> >>> This problem sounded familiar. I believe I've encountered something
> >>> similar with a different application.
> >>> =3D20
> >>> I downloaded speedbundle-1.0.tar.gz, unpacked it and searched for
> >>> the string "failed to create socket":
> >>> =3D20
> >>> gwiz% grep -r 'failed to create socket' speedbundle-1.0
> >>> speedbundle-1.0/ppp/pppd/plugins/pppoatm.c: fatal("failed to
> >>> create socket: %m");
> >>> =3D20
> >>> I then edited the pppoatm.c file and searched again for the string
> >>> "failed to create socket". This was the relevant section of code:
> >>> =3D20
> >>> fd =3D3D socket(AF_ATMPVC, SOCK_DGRAM, 0);
> >>> if (fd < 0)
> >>> fatal("failed to create socket: %m");
> >>> =3D20
> >>> The last argument to socket() is the protocol. It used to be OK to
> >>> just pass a 0 for the protocol argument, but the kernel is now more
> >>> strict about this. A value of 0 for protocol is actually PF_UNSPEC
> >>> or protocol family unspecified.
> >>> =3D20
> >>> I believe it should be sufficient to just change the protocol argument
> >>> of 0 to PF_ATMPVC.
> >>> =3D20
> >> =20
> >> Alas no; still the same error. Any further ideas?
> >
> > Hello Bill,=20
> >
> > I think I have made a little progress.
> >
> > I learned from man 7 ip that the function
> > socket(AF_ATMPVC, SOCK_DGRAM, protocol) creates a udp_socket, for which the
> > only valid values of protocol are 0 and IPPROTO_UDP.
> >
> > As I know that 0 doesn't work, I tried the other value; but then the
> > compiler gives the error "undeclared".
> >
> > Do you think that the solution lies there? If so, where and how could I
> > introduce a declaration of IPPROTO_UDP?
>
> I would like to add this to my previous message above:
>
> I have gone a further step, in that I have found that IPPROTO_UDP is in
> /usr/include/netinet/inet.h.
>
> I therefore added in pppoatm.c the line
>
> #include <netinet/in.h>
>
> and I got a clean compilation.
>
> However, when running "pppd call speedtch", I got again the error "failed to
> create socket: Address family not supported by protocol".
>
> I am quite puzzled and wondering what is compatible with what.
>
> Does anyone know that? Might I have to touch up the kernel?
You definitely don't want to do that. IPPROTO_UDP is an IP protocol
within the IP (INET) protocol family (PF_INET), and is not meaningful
for the PF_ATMPVC protocol family.
My apologies as I misread the socket man page earlier. The original
code with the value of 0 for the protocol argument to the socket()
call was probably fine. It's sounding more like there's something
missing in your kernel that provides the PF_ATMPVC protocol family.
I just found this in /usr/include/atm.h that defines the possible
values for the protocol argument to the socket() call for ATM:
/* "protcol" values for the socket system call */
#define ATM_NO_AAL 0 /* AAL not specified */
#define ATM_AAL0 13 /* "raw" ATM cells */
#define ATM_AAL1 1 /* AAL1 (CBR) */
#define ATM_AAL2 2 /* AAL2 (VBR) */
#define ATM_AAL34 3 /* AAL3/4 (data) */
#define ATM_AAL5 5 /* AAL5 (data) */
Since I'm not sure what ATM Adaptation Layer (AAL) is used by PPPOATM,
I can't really say what the correct value for the protocol argument
should be (IP uses AAL5).
-Bill