Error: failed to create socket

Bill Fink yellowdog-general@lists.terrasoftsolutions.com
Fri Sep 5 23:49:01 2003


Hi Charles,

On Fri Sep 5 2003, Charles Trois wrote:

> Hello, may I submit this problem to the list?
> 
> After many attempts to install the software for the Alcatel SpeedTouch USB
> modem, I turned to the new package speedbundle-1.0, which is supposed to
> take care of everything.
> 
> As a matter of fact, the package installed quite smoothly. But, when I
> called pppd in the prescribed form, I got this error:
> 
> [root@sirrah root]# pppd call speedtch
> Plugin pppoatm.so loaded.
> PPPoATM plugin_init
> PPPoATM setdevname - remove unwanted options
> PPPoATM setdevname_pppoatm - SUCCESS:8.35
> modprobe: Can't locate module pppoatm
> failed to create socket: Address family not supported by protocol
> [root@sirrah root]#
> 
> The line about the module pppoatm does not worry me; it just means that the
> support is built in.
> 
> But I don't understand the last line: what protocol? what address family?
> 
> I should very grateful if someone could explain this thing and point out the
> corrections I have to make.

This problem sounded familiar.  I believe I've encountered something
similar with a different application.

I downloaded speedbundle-1.0.tar.gz, unpacked it and searched for
the string "failed to create socket":

gwiz% grep -r 'failed to create socket' speedbundle-1.0
speedbundle-1.0/ppp/pppd/plugins/pppoatm.c:             fatal("failed to create socket: %m");

I then edited the pppoatm.c file and searched again for the string
"failed to create socket".  This was the relevant section of code:

        fd = socket(AF_ATMPVC, SOCK_DGRAM, 0);
        if (fd < 0)
                fatal("failed to create socket: %m");

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.

I believe it should be sufficient to just change the protocol argument
of 0 to PF_ATMPVC.

PF_ATMPVC is actually defined to be the same as AF_ATMPVC as can
be seen in /usr/include/linux/socket.h:

gwiz% grep '[AP]F_ATMPVC' /usr/include/linux/socket.h
#define AF_ATMPVC       8       /* ATM PVCs                     */
#define PF_ATMPVC       AF_ATMPVC

This can also be seen by checking the speedbundle source (which defines
these constants in case the system doesn't):

gwiz% grep -r '[AP]F_ATMPVC' speedbundle-1.0 | grep def
speedbundle-1.0/linux-atm/src/include/atm.h:#ifndef AF_ATMPVC
speedbundle-1.0/linux-atm/src/include/atm.h:#define AF_ATMPVC   8
speedbundle-1.0/linux-atm/src/include/atm.h:#ifndef PF_ATMPVC
speedbundle-1.0/linux-atm/src/include/atm.h:#define PF_ATMPVC   AF_ATMPVC
speedbundle-1.0/linux-atm/ChangeLog: - lib/atm.h defined AF_ATMPVC to 20, but the correct value is 8. Likewise,

All of the above is based on general principles and will hopefully
be helpful.  However I have no personal experience with the speedbundle
package, but it may do the trick (should at least get you one step
further along).

						-Good luck

						-Bill