Error: failed to create socket
Bill Fink
yellowdog-general@lists.terrasoftsolutions.com
Mon Sep 8 16:50:01 2003
On Mon, 08 Sep 2003, Charles Trois wrote:
> le 7/09/03 20:01, yellowdog-general-request@lists.terrasoftsolutions.com à
> yellowdog-general-request@lists.terrasoftsolutions.com a écrit :
>
> >
> > 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
> >
> > le 6/09/03 19:25, yellowdog-general-request@lists.terrasoftsolutions.com =E0
> > yellowdog-general-request@lists.terrasoftsolutions.com a =E9crit=A0:
> >
> >> Hi Charles,
> >> =20
> >> This problem sounded familiar. I believe I've encountered something
> >> similar with a different application.
> >> =20
> >> I downloaded speedbundle-1.0.tar.gz, unpacked it and searched for
> >> the string "failed to create socket":
> >> =20
> >> gwiz% grep -r 'failed to create socket' speedbundle-1.0
> >> speedbundle-1.0/ppp/pppd/plugins/pppoatm.c: fatal("failed to
> >> create socket: %m");
> >> =20
> >> I then edited the pppoatm.c file and searched again for the string
> >> "failed to create socket". This was the relevant section of code:
> >> =20
> >> fd =3D socket(AF_ATMPVC, SOCK_DGRAM, 0);
> >> if (fd < 0)
> >> fatal("failed to create socket: %m");
> >> =20
> >> 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.
> >> =20
> >> I believe it should be sufficient to just change the protocol argument
> >> of 0 to PF_ATMPVC.
> >> =20
> >
> > Alas no; still the same error. Any further ideas?
>
> Hello Bill,
>
> 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?
No I don't think you want to use IPPROTO_UDP. ATM is not an IP protocol.
It is it's own whole address/protocol family. I'm fairly sure PF_ATMPVC
is the correct value for the protocol argument to socket, which is
creating an ATMPVC datagram socket, and not an IP datagram socket.
-Bill