use ephemeral ports

This commit is contained in:
Jonno Downes 2020-01-19 19:08:49 +11:00 committed by Oliver Schmidt
parent a25ed5051f
commit e0bd530148

View File

@ -51,7 +51,7 @@ dns_arcount = 10
dns_qname = 12 dns_qname = 12
dns_server_port = 53 dns_server_port = 53
dns_client_port_low_byte: .res 1 dns_client_port_high_byte: .res 1
dns_ip: .res 4 ; will be contain ip address of hostname after succesful exection of dns_resolve dns_ip: .res 4 ; will be contain ip address of hostname after succesful exection of dns_resolve
@ -184,9 +184,9 @@ dns_resolve:
@hostname_not_dotted_quad: @hostname_not_dotted_quad:
ldax #dns_in ldax #dns_in
stax udp_callback stax udp_callback
lda #53 ldx #53
inc dns_client_port_low_byte ; each call to resolve uses a different client address inc dns_client_port_high_byte ; each call to resolve uses a different client address
ldx dns_client_port_low_byte ; so we don't get confused by late replies to a previous call lda dns_client_port_high_byte ; so we don't get confused by late replies to a previous call
jsr udp_add_listener jsr udp_add_listener
bcc :+ bcc :+
@ -255,8 +255,8 @@ dns_resolve:
clc ; signal success clc ; signal success
@done: @done:
php php
lda #53 ldx #53
ldx dns_client_port_low_byte lda dns_client_port_high_byte
jsr udp_remove_listener jsr udp_remove_listener
plp plp
rts rts
@ -302,8 +302,8 @@ send_dns_query:
ldx #0 ldx #0
stax udp_send_len stax udp_send_len
lda #53 ldx #53
ldx dns_client_port_low_byte lda dns_client_port_high_byte
stax udp_send_src_port stax udp_send_src_port
ldx #3 ; set destination address ldx #3 ; set destination address