Date: Sun, 28 Apr 2024 21:33:45 +0200 From: Dirk-Willem van Gulik <dirkx@webweaving.org> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Multicast & Tunnel devices Message-ID: <D00CB346-F704-4111-8C7B-648EFA8A8C89@webweaving.org>
next in thread | raw e-mail | index | archive | help
--Apple-Mail=_2C77F2BB-87C7-4F5B-A2B8-5CD33CED02FF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Would anyone know if there is something special with tunnel devices and = multicast ?=20 I=E2=80=99ve got some code that happily processes multicast packets on a = normal interface; but appears not to do this on a tunnel interface. Tun0 = shows multicast enabled: =09 tun0: flags=3D8043<UP,BROADCAST,RUNNING,MULTICAST> metric 0 mtu = 1500 Tcpdump on that interface gives the expected thing (here with mDNS): tcpdump -n -i tun0 port 5353 listening on tun0, link-type NULL (BSD loopback), capture size = 262144 bytes 19:26:03.976259 IP 10.31.0.6.5353 > 224.0.0.251.5353: 0 PTR = (QM)? _raop._tcp.local. (34) And code, with a simple IP_ADD_MEMBERSHIP of the MC group on the IP of = the local interface below works on a normal interface (e.g. = igb0/10.0.0.1/24).=20 ./listener 10.0.0.1 224.0.0.251 5353 Received packet, len=3D128 etc But yields no output if ran against above tun0 interface (while tcpdump = on same is fine). Does that ring a bell with anyone ? Dw int main(int argc, char *argv[]) { struct sockaddr_in addr; struct ip_mreq mreq; // skip error trapping command line arguments char* ip =3D argv[1];=20 char* group =3D argv[2];=20 int port =3D atoi(argv[3]); // 0 if error, which is an invalid port memset(&addr, 0, sizeof(addr)); addr.sin_family =3D AF_INET; addr.sin_addr.s_addr =3D htonl(INADDR_ANY); addr.sin_port =3D htons(port); mreq.imr_interface.s_addr =3D inet_addr(ip);=20 mreq.imr_multiaddr.s_addr =3D inet_addr(group); // skip error trapping on inet_addr int fd =3D socket(AF_INET, SOCK_DGRAM, 0); // skip error trapping socket if (bind(fd, (struct sockaddr*) &addr, sizeof(addr)) < 0) { // skip error trapping if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*) &mreq, = sizeof(mreq)) < 0 ){ // skip error trapping argumetns while (1) { .. int nbytes =3D recvfrom(fd,msgbuf,MSGBUFSIZE,0,(struct sockaddr = *) &addr,&addrlen); if (nbytes < 0) { perror("recvfrom"); return 1; } printf(=E2=80=9CReceived packet, len=3D%d\n", nbytes); } --Apple-Mail=_2C77F2BB-87C7-4F5B-A2B8-5CD33CED02FF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;">Would anyone = know if there is something special with tunnel devices and multicast = ? <div><br></div><div>I=E2=80=99ve got some code that happily = processes multicast packets on a normal interface; but appears not to do = this on a tunnel interface. Tun0 shows multicast enabled:<div><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span></div><div><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span style=3D"font-family: = Menlo; font-size: 11px;">tun0: = flags=3D8043<UP,BROADCAST,RUNNING,MULTICAST> metric 0 mtu = 1500</span></div><div><span style=3D"font-family: Menlo; font-size: = 11px;"><br></span></div><div><font face=3D"Menlo"><span = style=3D"font-size: 11px;">Tcpdump on that interface gives the expected = thing (here with mDNS):</span></font></div><div><font face=3D"Menlo"><span= style=3D"font-size: 11px;"><br></span></font></div><div><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>tcpdump -n -i tun0 port = 5353</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>listening on tun0, link-type NULL = (BSD loopback), capture size 262144 bytes</p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>19:26:03.976259 IP 10.31.0.6.5353 = > 224.0.0.251.5353: 0 PTR (QM)? _raop._tcp.local. (34)</span></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><br></span></p><p style=3D"margin: 0px; font-style: = normal; font-variant-caps: normal; font-stretch: normal; font-size: = 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures">And code, with a = simple </span>IP_ADD_MEMBERSHIP of the MC group on the IP of = the local interface below works on a normal interface (e.g. = igb0/10.0.0.1/24). </p><p style=3D"margin: 0px; font-style: normal; = font-variant-caps: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures"><br></span></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>./listener </span>10.0.0.1 = 224.0.0.251 5353</p><p style=3D"margin: 0px; font-style: normal; = font-variant-caps: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>Received = packet, len=3D128</p><p style=3D"margin: 0px; font-style: normal; = font-variant-caps: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>etc</p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><br></p><p style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures;">But yields no = output if ran against above tun0 interface (while tcpdump on same is = fine). Does that ring a bell with anyone ?</span></p><p style=3D"margin: = 0px; font-stretch: normal; font-size: 11px; line-height: normal; = font-family: Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures;"><br></span></p><p = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures;">Dw</span></p></div><div><span = style=3D"font-variant-ligatures: = no-common-ligatures;"><br></span></div><div><span = style=3D"font-variant-ligatures: = no-common-ligatures;"><br></span></div><div><span = style=3D"font-variant-ligatures: no-common-ligatures;"><p style=3D"margin:= 0px; font-style: normal; font-variant-caps: normal; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; = font-size-adjust: none; font-kerning: auto; font-variant-alternates: = normal; font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures">int main(int argc, = char *argv[])</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures">{</span></p><p style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; = font-size-adjust: none; font-kerning: auto; font-variant-alternates: = normal; font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"> struct sockaddr_in = addr;</p><p style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures;"> struct ip_mreq = mreq;</span></p><p style=3D"margin: 0px; font-style: normal; = font-variant-caps: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><br></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>// skip error trapping command = line arguments</p><p style=3D"margin: 0px; font-style: normal; = font-variant-caps: normal; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><br></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"> char* ip =3D = argv[1]; </p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> char* group =3D = argv[2]; </span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> int port =3D atoi(argv[3]); // 0 if = error, which is an invalid port</span></p><p style=3D"margin: 0px; = font-style: normal; font-variant-caps: normal; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; = font-size-adjust: none; font-kerning: auto; font-variant-alternates: = normal; font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><br></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> memset(&addr, 0, = sizeof(addr));</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> addr.sin_family =3D = AF_INET;</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> addr.sin_addr.s_addr =3D = htonl(INADDR_ANY);</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> addr.sin_port =3D = htons(port);</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; min-height: 13px;"><span = style=3D"font-variant-ligatures: no-common-ligatures"></span><br></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures;"> mreq.imr_interface.s_addr =3D = inet_addr(ip); </span></p><p style=3D"margin: 0px; font-style: = normal; font-variant-caps: normal; font-stretch: normal; font-size: = 11px; line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-variant-emoji: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"> = mreq.imr_multiaddr.s_addr =3D inet_addr(group);</p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><br></p><p style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>// skip = error trapping on inet_addr</p><div><br></div><p style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-feature-settings: normal; = font-optical-sizing: auto; font-variation-settings: normal;"><span = style=3D"font-variant-ligatures: no-common-ligatures;"> = int fd =3D socket(AF_INET, SOCK_DGRAM, 0);</span></p><p = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>// skip error trapping = socket</p><div><br></div> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> if (bind(fd, (struct sockaddr*) = &addr, sizeof(addr)) < 0) {</span></p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>// skip error = trapping</p><div><br></div> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> if (</span>setsockopt(<span = style=3D"font-variant-ligatures: no-common-ligatures;">fd, IPPROTO_IP, = IP_ADD_MEMBERSHIP, (char*) &mreq, sizeof(mreq)</span>) < 0 ){</p> <p style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; font-size-adjust: none; = font-kerning: auto; font-variant-alternates: normal; = font-variant-ligatures: normal; font-variant-numeric: normal; = font-variant-east-asian: normal; font-variant-position: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>// skip error trapping = argumetns</p><div><br></div> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> while (1) {</span></p><p = style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>..</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"> int nbytes = =3D recvfrom(fd,msgbuf,MSGBUFSIZE,0,(struct sockaddr *) = &addr,&addrlen);</p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> if (nbytes < 0) = {</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> = perror("recvfrom");</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> return = 1;</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"> }</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"><span style=3D"font-variant-ligatures: = no-common-ligatures"><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>printf(=E2=80=9CReceived packet, = len=3D%d\n", nbytes);</span></p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal;"> }</p> <p style=3D"margin: 0px; font-style: normal; font-variant-caps: normal; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; font-size-adjust: none; font-kerning: auto; = font-variant-alternates: normal; font-variant-ligatures: normal; = font-variant-numeric: normal; font-variant-east-asian: normal; = font-variant-position: normal; font-variant-emoji: normal; = font-feature-settings: normal; font-optical-sizing: auto; = font-variation-settings: normal; min-height: = 13px;"><br></p></span></div></div></body></html>= --Apple-Mail=_2C77F2BB-87C7-4F5B-A2B8-5CD33CED02FF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D00CB346-F704-4111-8C7B-648EFA8A8C89>