Project

General

Profile

Bug #6603

lua-socket fails to open socket

Added by Ted Trask about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Aports
Target version:
Start date:
12/29/2016
Due date:
% Done:

100%

Estimated time:
Affected versions:
Security IDs:

Description

Running on edge as root with lua-socket installed:

  1. lua -e 'assert(require("socket").udp():sendto("test", "127.0.0.1", 80))'
    lua: (command line):1: refused
    stack traceback:
    [C]: in function 'assert'
    (command line):1: in main chunk
    [C]: ?

This used to work on Alpine 3.2. Haven't tested on versions inbetween yet.

Associated revisions

Revision 72ccba0e (diff)
Added by Natanael Copa almost 2 years ago

main/lua-socket: fix udp socket on first sendto

ref #6603

sent upstream: https://github.com/diegonehab/luasocket/pull/206

Revision e13e9f0a (diff)
Added by Natanael Copa almost 2 years ago

main/lua-socket: fix udp socket on first sendto

fixes #6603

sent upstream: https://github.com/diegonehab/luasocket/pull/206

(cherry picked from commit 72ccba0e9bd2e371b6356a045431674d471ed5a2)

History

#1 Updated by Natanael Copa about 2 years ago

  • Target version set to 3.5.1

#2 Updated by Steve McMaster about 2 years ago

This seems to have broken between Alpine 3.3 and Alpine 3.4, which makes sense because the version of lua-socket in 3.4 is roughly a year newer.

/ # apk add --update lua lua-socket
fetch http://alpine.gliderlabs.com/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
fetch http://alpine.gliderlabs.com/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
(1/5) Installing lua5.1-libs (5.1.5-r1)
(2/5) Installing lua5.1 (5.1.5-r1)
(3/5) Installing lua (5.1.5-r4)
(4/5) Installing lua5.1-socket (3.0_rc1_git20150301-r0)
(5/5) Installing lua-socket (3.0_rc1_git20150301-r0)
Executing busybox-1.24.2-r0.trigger
OK: 5 MiB in 16 packages
/ # lua -e 'assert(require("socket").udp():sendto("test", "127.0.0.1", 80))'
/ #
/ # apk add --update lua lua-socket
fetch http://alpine.gliderlabs.com/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://alpine.gliderlabs.com/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/5) Installing lua5.1-libs (5.1.5-r1)
(2/5) Installing lua5.1 (5.1.5-r1)
(3/5) Installing lua (5.1.5-r4)
(4/5) Installing lua-socket (3.0_rc1_git20160306-r1)
(5/5) Installing lua5.1-socket (3.0_rc1_git20160306-r1)
Executing busybox-1.24.2-r11.trigger
OK: 5 MiB in 16 packages
/ # lua -e 'assert(require("socket").udp():sendto("test", "127.0.0.1", 80))'
lua: (command line):1: refused
stack traceback:
    [C]: in function 'assert'
    (command line):1: in main chunk
    [C]: ?
/ #

#3 Updated by Timo Teräs about 2 years ago

Seems upstream changed .udp() to be address-agnostic socket type (.udp4() is the ipv4 version). See https://github.com/diegonehab/luasocket/issues/147

Though, the docs would indicate that sendto() would bind the socket to asked address family, it does not seem to work so this is an upstream bug. One workaround would be to use .udp4() to ask for ipv4 socket. But preferable we could ask upstream to fix the issue. First sendto() call on af_unspec socket should bind that socket to address-family of the given address as promised in the docs.

#5 Updated by Natanael Copa almost 2 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#6 Updated by Natanael Copa almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF