From nobody Tue Oct 18 03:25:30 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MrzlZ00n9z4fZ9Z for ; Tue, 18 Oct 2022 03:25:46 +0000 (UTC) (envelope-from rickywu0421@gmail.com) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MrzlX6R1nz3QkH for ; Tue, 18 Oct 2022 03:25:44 +0000 (UTC) (envelope-from rickywu0421@gmail.com) Received: by mail-io1-xd31.google.com with SMTP id l127so10760487iof.12 for ; Mon, 17 Oct 2022 20:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=oJbE57uzjHax8tHpIosAtkTQsNRBwu91jNe/uPbikIU=; b=omRvuhRoIauKhWa82bB9tzefhwnES28CwUDIrR9GD7NXq4F3bIVM5gU+UT0x0kJa2+ 8cjf8dbZJFdvL7MyP41wheuj6rSSA3+fsJbRhbm1Itqu+P8tO16W7nUam57tGbvqjnGk 8leuHQPi4ztK9XFljYY/E9vlsXi5xJKl0HOSeEd+p6ItpBQeeXO3M4rrRXaITA1txQUU 7i0jGrE+ce4b0VpgUxKmPTGhtYqjMh8rtUsMJGNjxluogcRDpHD3pv956ANNOgzYpQa0 fFPEPJDgSQzMEGQkqSeWLO8PPZE/xq0yw3UePFydnMfzkvkE+mUjlb+VXmWI3POhyxKQ TU+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=oJbE57uzjHax8tHpIosAtkTQsNRBwu91jNe/uPbikIU=; b=DjNCfMbtLmJDQ3PlfOmiA+zWCAPFEu/FobVyTtm00IcwxY1x1JWF4bWoSf27WuD7WE 4RmJmhWu/I75QzCUPZPYu3kI3puR5aMd8YlKlkLglEntXB3YiC+UoBPLxg/323cupCIH UmBDu+fppTtYb+MCksNJFS9r62dx49pIM17cpoZJrNrUDHoDCHU+pbJwKgf2d8zsd7ib vT1XzwMOuh5oJitSY7WlYNj4aH283V2EarP1Gv2V1lq8WqX6Qa8SQYEZJ0tGnj0AjaLI zxr7WAJ/ASHqisdGLlKyy6V4Jwb7ZgoOvYeAwhpTyWpM+LByACA29y52NcJFuEgf07lN 2TOQ== X-Gm-Message-State: ACrzQf2TO1PUC+UDYkKwZxS19x77JHZDcgjIXus2ohLuH5nuvUTQjxaA CMKe/+pwvBeTKqqP3YA3DGXBhYkZyh26+8ul908pBI51LESLhg== X-Google-Smtp-Source: AMsMyM5oyHsIv5yvE0iFIxBfIQbbxEANul3iqaTrRjhrYQEC2C9PhPbY4+6rx98Rcx14yxUw7mE/6RN149DmO7EYy8M= X-Received: by 2002:a05:6602:1409:b0:6a4:cef3:ea7f with SMTP id t9-20020a056602140900b006a4cef3ea7fmr817334iov.41.1666063543937; Mon, 17 Oct 2022 20:25:43 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 From: =?UTF-8?B?5ZCz5oGp57ev?= Date: Tue, 18 Oct 2022 11:25:30 +0800 Message-ID: Subject: ifconfig(8) IEEE802.11 SSID format To: freebsd-hackers@freebsd.org Content-Type: multipart/alternative; boundary="000000000000b5b39905eb46a520" X-Rspamd-Queue-Id: 4MrzlX6R1nz3QkH X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=omRvuhRo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rickywu0421@gmail.com designates 2607:f8b0:4864:20::d31 as permitted sender) smtp.mailfrom=rickywu0421@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d31:from]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_NONE(0.00)[]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: N --000000000000b5b39905eb46a520 Content-Type: text/plain; charset="UTF-8" Currently `ifconfig wlanX scan` will show SSID in hex when the scanned SSID is non-printable. And the non-printable character is when the character with value < 32 or value >= 126 in ifconfig(8)'s implementation. That leads to a problem that other languages using UTF-8 or other encoding will be treated as non-printable in ifconfig(8), thus not printed on screen. Here is the possible way to solve the problem: When a SSID is going to be printed, copy the byte stream (uint8_t *) into wide character stream (wchar_t *), and use libc iswprint(3) to check whether characters are printable or non-printable. I have tested this and it is workable when the locale is correctly set. --000000000000b5b39905eb46a520 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Currently `ifconfig wlanX=C2=A0scan` will show SSID in hex= when the scanned SSID is non-printable. And the non-printable character is= when the character with value < 32 or value >=3D 126 in ifconfig(8)&= #39;s implementation. That leads to a problem that other languages using UT= F-8 or other encoding will be treated as non-printable in ifconfig(8), thus= not printed on screen.=C2=A0

Here is the possible way t= o solve the problem:
When a SSID is going to be printed, copy the= byte stream (uint8_t *) into wide character stream (wchar_t *), and use li= bc iswprint(3) to check whether characters are printable or non-printable. = I have tested this and it is workable when the locale is correctly set.
--000000000000b5b39905eb46a520--