/[gentoo-x86]/net-misc/netkit-talk/files/netkit-talk-0.17-ipv6.diff
Gentoo

Contents of /net-misc/netkit-talk/files/netkit-talk-0.17-ipv6.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Sun Oct 19 07:38:55 2014 UTC (5 years, 5 months ago) by jer
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +2 -3 lines
File MIME type: text/x-diff
EAPI bump. Fix building against sys-libs/ncurses[tinfo] (bug #525796 by Reuben Martin).

(Portage version: 2.2.14_rc1/cvs/Linux x86_64, signed Manifest commit with key A792A613)

1 --- a/talkd/talkd.c
2 +++ b/talkd/talkd.c
3 @@ -164,13 +164,14 @@
4 const char *theirip;
5
6 struct hostent *hp;
7 + struct sockaddr_in6 addr;
8 struct sockaddr_in sn;
9 int cc, i, ok;
10 socklen_t addrlen;
11
12 - addrlen = sizeof(sn);
13 + addrlen = sizeof(addr);
14 cc = recvfrom(0, inbuf, sizeof(inbuf), 0,
15 - (struct sockaddr *)&sn, &addrlen);
16 + (struct sockaddr *)&addr, &addrlen);
17 if (cc<0) {
18 if (errno==EINTR || errno==EAGAIN) {
19 return;
20 @@ -185,14 +186,30 @@
21 */
22 lastmsgtime = time(NULL);
23
24 - if (addrlen!=sizeof(sn)) {
25 - syslog(LOG_WARNING, "recvfrom: bogus address length");
26 - return;
27 - }
28 - if (sn.sin_family!=AF_INET) {
29 + sn.sin_family = AF_INET;
30 + switch (addr.sin6_family)
31 + {
32 + case AF_INET:
33 + sn.sin_addr=((struct sockaddr_in*)&addr)->sin_addr;
34 + sn.sin_port=((struct sockaddr_in*)&addr)->sin_port;
35 + break;
36 + case AF_INET6:
37 + // addr must be ::FFFF:x.x.x.x
38 + if (addr.sin6_addr.s6_addr32[0]!=0 ||
39 + addr.sin6_addr.s6_addr32[1]!=0 ||
40 + addr.sin6_addr.s6_addr16[5]!=0xffff ||
41 + addr.sin6_addr.s6_addr16[4]!=0)
42 + {
43 + syslog(LOG_WARNING, "IPv6 address family not supported by talkd");
44 + return;
45 + }
46 + sn.sin_port=addr.sin6_port;
47 + sn.sin_addr.s_addr=addr.sin6_addr.s6_addr32[3];
48 + break;
49 + default:
50 syslog(LOG_WARNING, "recvfrom: bogus address family");
51 return;
52 - }
53 + }
54
55 /*
56 * If we get here we have an address we can reply to, although

  ViewVC Help
Powered by ViewVC 1.1.20