From owner-freebsd-wireless@freebsd.org Thu Dec 27 12:25:27 2018 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24D13135D175; Thu, 27 Dec 2018 12:25:27 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 098F671142; Thu, 27 Dec 2018 12:25:25 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [132.174.172.2] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1gcUiz-0006NK-Cn; Thu, 27 Dec 2018 13:25:17 +0100 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id wBRCPH7S003435 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Dec 2018 13:25:17 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id wBRCPHVK003434; Thu, 27 Dec 2018 13:25:17 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Thu, 27 Dec 2018 13:25:17 +0100 From: Matthias Apitz To: freebsd-questions@freebsd.org Cc: freebsd-wireless@freebsd.org Subject: DHCP problems while connecting with a Wifi AP Message-ID: <20181227122517.GA3208@c720-r314251> Reply-To: Matthias Apitz Mail-Followup-To: freebsd-questions@freebsd.org, freebsd-wireless@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.8.0 (2017-02-23) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 132.174.172.2 X-Rspamd-Queue-Id: 098F671142 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.76 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[guru@unixarea.de]; HAS_XOIP(0.00)[]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[mail.unixarea.de]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.61)[-0.613,0]; RCVD_IN_DNSWL_LOW(-0.10)[101.4.254.178.list.dnswl.org : 127.0.5.1]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:42730, ipnet:178.254.0.0/19, country:DE]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[unixarea.de]; AUTH_NA(1.00)[]; IP_SCORE(-1.45)[ipnet: 178.254.0.0/19(-4.01), asn: 42730(-3.21), country: DE(-0.01)]; R_SPF_NA(0.00)[]; MID_RHS_NOT_FQDN(0.50)[] X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 12:25:27 -0000 Hello, I'm using my (Ubuntu) mobile device as AP to connect my FreeBSD laptop to the Internet. While this is working fine most of the times, I encounter in some situation problems getting an IP addr with DHCP from the mobile. It looks somehow like a race condition between WPA associating and DHCP (dhclient) asking to early (and giving up). Here is a typical situation when it does not work: Dec 27 11:58:25 c720-r314251 kernel: ifa_maintain_loopback_route: insertion failed for interface wlan0: 17 Dec 27 11:59:22 c720-r314251 wpa_supplicant[7871]: wlan0: Trying to associate with 4e:74:03:65:46:a9 (SSID='UbuntuBQ' freq=2412 MHz) Dec 27 11:59:32 c720-r314251 wpa_supplicant[7871]: wlan0: Authentication with 4e:74:03:65:46:a9 timed out. Dec 27 11:59:32 c720-r314251 wpa_supplicant[7871]: wlan0: CTRL-EVENT-DISCONNECTED bssid=4e:74:03:65:46:a9 reason=3 locally_generated=1 Dec 27 11:59:52 c720-r314251 wpa_supplicant[7871]: wlan0: Trying to associate with 4e:74:03:65:46:a9 (SSID='UbuntuBQ' freq=2412 MHz) Dec 27 11:59:52 c720-r314251 wpa_supplicant[7871]: wlan0: Associated with 4e:74:03:65:46:a9 Dec 27 11:59:52 c720-r314251 kernel: wlan0: link state changed to UP Dec 27 11:59:52 c720-r314251 dhclient[7941]: send_packet: No buffer space available Dec 27 11:59:53 c720-r314251 wpa_supplicant[7871]: wlan0: WPA: Key negotiation completed with 4e:74:03:65:46:a9 [PTK=CCMP GTK=CCMP] Dec 27 11:59:53 c720-r314251 wpa_supplicant[7871]: wlan0: CTRL-EVENT-CONNECTED - Connection to 4e:74:03:65:46:a9 completed [id=1 id_str=] As you can see, the 'dhclient[7941]: send_packet: No buffer space available' comes *before* the connection to the AP is completed. A tcpdump shows in such a situation that the device is not answering: root@c720-r314251:/var/db # tcpdump -n -i wlan0 port 67 09:52:45.426053 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 09:52:45.426926 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 09:52:46.465668 EAPOL key (3) v2, len 95 09:52:46.466180 EAPOL key (3) v1, len 117 09:52:46.472944 EAPOL key (3) v2, len 151 09:52:46.473183 EAPOL key (3) v1, len 95 09:52:52.429945 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 09:53:02.438749 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 09:53:19.446098 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 09:53:40.455949 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 90:48:9a:92:9e:43, length 300 It seems that the BOOTP/DHCP requests are not really sent to the AP because they are not visible with tcpdump in the Ubuntu device. At the same time, they are not logged by the ipfilter firewall on my laptop. The rules in question are: pass out quick log on wlan0 proto tcp from any to any port = 53 flags S keep state pass out quick log on wlan0 proto udp from any to any port = 53 keep state pass out quick log on wlan0 proto udp from any to any port = 67 keep state pass out quick log on wlan0 proto udp from any to any port = 68 keep state Any ideas re/ the following question: 1. How could I delay the dhclient until connection is fine? 2. Why the BOOTP/DHCP are not logged by the ipfilter? This could smell as a problem caused by the AP, but any other device (for example an iPhone) connects fine and gets an IP addr. Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub October, 7 -- The GDR was different: Peace instead of Bundeswehr and wars, Druschba instead of Nazis, to live instead of to survive.