Check-in [d4669e7bab]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid failing when ipv6/pp doesn't work, e.g. on WSL 1
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d4669e7bab24d9102ac3a607a7ba1be10f376403
User & Date: bernd 2020-06-18 11:22:50.735
Context
2020-06-18
13:23
Bump version number check-in: 5703baa868 user: bernd tags: trunk, 0.9.8-20200618
11:22
Avoid failing when ipv6/pp doesn't work, e.g. on WSL 1 check-in: d4669e7bab user: bernd tags: trunk
2020-06-11
17:46
Update for newer Android toolchain check-in: a57b500ccd user: bernd tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to ip.fs.
133
134
135
136
137
138
139


140
141
142
143
144
145
146
147
148
149
150
151

: my-port ( -- port )
    ipv6( sockaddr_in6 )else( sockaddr_in4 ) alen !
    net2o-sock [IFDEF] no-hybrid drop [THEN] sockaddr1 alen getsockname ?ior
    sockaddr1 port be-uw@ ;

: ipv6/pp ( sock -- sock )


    [IFDEF] ipv6-public
	config:port# @ IF
	    ipv6( dup ipv6-public )
	ELSE
	    ipv6( dup ipv6-private )
	THEN
    [THEN]
;

: sock[ ( -- )  query-sock ?EXIT
    ipv4( ipv6( new-udp-socket46 )else( new-udp-socket ) )else( new-udp-socket6 )
    ipv6/pp to query-sock ;







>
>


|

|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

: my-port ( -- port )
    ipv6( sockaddr_in6 )else( sockaddr_in4 ) alen !
    net2o-sock [IFDEF] no-hybrid drop [THEN] sockaddr1 alen getsockname ?ior
    sockaddr1 port be-uw@ ;

: ipv6/pp ( sock -- sock )
    \ try to prefer public or private addresses
    \ if this is not available (e.g. WSL 1), just ignore
    [IFDEF] ipv6-public
	config:port# @ IF
	    ipv6( [: dup ipv6-public ;] catch drop )
	ELSE
	    ipv6( [: dup ipv6-private ;] catch drop )
	THEN
    [THEN]
;

: sock[ ( -- )  query-sock ?EXIT
    ipv4( ipv6( new-udp-socket46 )else( new-udp-socket ) )else( new-udp-socket6 )
    ipv6/pp to query-sock ;