summaryrefslogtreecommitdiff
path: root/toxcore/LAN_discovery.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-03-14 02:22:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-03-14 13:28:42 +0000
commitcb22b3df5f0b7509a37e091360ecbb4d8a9f2873 (patch)
treedd12e81f5f61e6ec268bd03d2e6951a7abee9506 /toxcore/LAN_discovery.c
parent11ad5471b91dc1b36552ba4e5a3ea434c8a30f5f (diff)
Fix up comments a bit to start being more uniform.
Tokstyle (check-cimple) will start enforcing comment formats at some point. It will not support arbitrary stuff in comments, and will parse them. The result can then be semantically analysed.
Diffstat (limited to 'toxcore/LAN_discovery.c')
-rw-r--r--toxcore/LAN_discovery.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index b1be2600..c3d06014 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -57,8 +57,8 @@ static void fetch_broadcast_info(uint16_t port)
57 } 57 }
58 } 58 }
59 59
60 /* We copy these to the static variables broadcast_* only at the end of fetch_broadcast_info(). 60 /* We copy these to the static variables `broadcast_*` only at the end of `fetch_broadcast_info()`.
61 * The intention is to ensure that even if multiple threads enter fetch_broadcast_info() concurrently, only valid 61 * The intention is to ensure that even if multiple threads enter `fetch_broadcast_info()` concurrently, only valid
62 * interfaces will be set to be broadcast to. 62 * interfaces will be set to be broadcast to.
63 * */ 63 * */
64 int count = 0; 64 int count = 0;
@@ -123,7 +123,7 @@ static void fetch_broadcast_info(uint16_t port)
123static void fetch_broadcast_info(uint16_t port) 123static void fetch_broadcast_info(uint16_t port)
124{ 124{
125 /* Not sure how many platforms this will run on, 125 /* Not sure how many platforms this will run on,
126 * so it's wrapped in __linux for now. 126 * so it's wrapped in `__linux__` for now.
127 * Definitely won't work like this on Windows... 127 * Definitely won't work like this on Windows...
128 */ 128 */
129 broadcast_count = 0; 129 broadcast_count = 0;
@@ -146,15 +146,15 @@ static void fetch_broadcast_info(uint16_t port)
146 return; 146 return;
147 } 147 }
148 148
149 /* We copy these to the static variables broadcast_* only at the end of fetch_broadcast_info(). 149 /* We copy these to the static variables `broadcast_*` only at the end of `fetch_broadcast_info()`.
150 * The intention is to ensure that even if multiple threads enter fetch_broadcast_info() concurrently, only valid 150 * The intention is to ensure that even if multiple threads enter `fetch_broadcast_info()` concurrently, only valid
151 * interfaces will be set to be broadcast to. 151 * interfaces will be set to be broadcast to.
152 * */ 152 * */
153 int count = 0; 153 int count = 0;
154 IP_Port ip_ports[MAX_INTERFACES]; 154 IP_Port ip_ports[MAX_INTERFACES];
155 155
156 /* ifc.ifc_len is set by the ioctl() to the actual length used; 156 /* `ifc.ifc_len` is set by the `ioctl()` to the actual length used.
157 * on usage of the complete array the call should be repeated with 157 * On usage of the complete array the call should be repeated with
158 * a larger array, not done (640kB and 16 interfaces shall be 158 * a larger array, not done (640kB and 16 interfaces shall be
159 * enough, for everybody!) 159 * enough, for everybody!)
160 */ 160 */
@@ -239,8 +239,8 @@ static IP broadcast_ip(Family family_socket, Family family_broadcast)
239 if (net_family_is_ipv6(family_socket)) { 239 if (net_family_is_ipv6(family_socket)) {
240 if (net_family_is_ipv6(family_broadcast)) { 240 if (net_family_is_ipv6(family_broadcast)) {
241 ip.family = net_family_ipv6; 241 ip.family = net_family_ipv6;
242 /* FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */ 242 /* `FF02::1` is - according to RFC 4291 - multicast all-nodes link-local */
243 /* FE80::*: MUST be exact, for that we would need to look over all 243 /* `FE80::*:` MUST be exact, for that we would need to look over all
244 * interfaces and check in which status they are */ 244 * interfaces and check in which status they are */
245 ip.ip.v6.uint8[ 0] = 0xFF; 245 ip.ip.v6.uint8[ 0] = 0xFF;
246 ip.ip.v6.uint8[ 1] = 0x02; 246 ip.ip.v6.uint8[ 1] = 0x02;
@@ -328,8 +328,8 @@ bool ip_is_lan(IP ip)
328 } 328 }
329 329
330 if (net_family_is_ipv6(ip.family)) { 330 if (net_family_is_ipv6(ip.family)) {
331 /* autogenerated for each interface: FE80::* (up to FEBF::*) 331 /* autogenerated for each interface: `FE80::*` (up to `FEBF::*`)
332 FF02::1 is - according to RFC 4291 - multicast all-nodes link-local */ 332 `FF02::1` is - according to RFC 4291 - multicast all-nodes link-local */
333 if (((ip.ip.v6.uint8[0] == 0xFF) && (ip.ip.v6.uint8[1] < 3) && (ip.ip.v6.uint8[15] == 1)) || 333 if (((ip.ip.v6.uint8[0] == 0xFF) && (ip.ip.v6.uint8[1] < 3) && (ip.ip.v6.uint8[15] == 1)) ||
334 ((ip.ip.v6.uint8[0] == 0xFE) && ((ip.ip.v6.uint8[1] & 0xC0) == 0x80))) { 334 ((ip.ip.v6.uint8[0] == 0xFE) && ((ip.ip.v6.uint8[1] & 0xC0) == 0x80))) {
335 return true; 335 return true;