Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149364913
D14505.id39712.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D14505.id39712.diff
View Options
Index: include/protocols/talkd.h
===================================================================
--- include/protocols/talkd.h
+++ include/protocols/talkd.h
@@ -54,6 +54,15 @@
* stream connection through which the conversation takes place.
*/
+/*
+ * The talk protocol embeds a 4.3BSD sockaddr. Define our own version
+ * rather then relying on namespace polution in kernel headers.
+ */
+struct tsockaddr {
+ unsigned short sa_family;
+ char sa_data[14];
+};
+
/*
* Client->server request message format.
*/
@@ -63,8 +72,8 @@
u_char answer; /* not used */
u_char pad;
u_int32_t id_num; /* message id */
- struct osockaddr addr; /* old (4.3) style */
- struct osockaddr ctl_addr; /* old (4.3) style */
+ struct tsockaddr addr; /* old (4.3) style */
+ struct tsockaddr ctl_addr; /* old (4.3) style */
int32_t pid; /* caller's process id */
#define NAME_SIZE 12
char l_name[NAME_SIZE];/* caller's name */
@@ -82,7 +91,7 @@
u_char answer; /* respose to request message, see below */
u_char pad;
u_int32_t id_num; /* message id */
- struct osockaddr addr; /* address for establishing conversation */
+ struct tsockaddr addr; /* address for establishing conversation */
} CTL_RESPONSE;
#define TALK_VERSION 1 /* protocol version */
Index: libexec/talkd/talkd.c
===================================================================
--- libexec/talkd/talkd.c
+++ libexec/talkd/talkd.c
@@ -114,7 +114,8 @@
continue;
}
lastmsgtime = time(0);
- (void)memcpy(&ctl_addr, &mp->ctl_addr, sizeof(ctl_addr));
+ (void)memcpy(&ctl_addr.sa_data, &mp->ctl_addr.sa_data,
+ sizeof(ctl_addr.sa_data));
ctl_addr.sa_family = ntohs(mp->ctl_addr.sa_family);
ctl_addr.sa_len = sizeof(ctl_addr);
process_request(mp, &response);
Index: usr.bin/talk/invite.c
===================================================================
--- usr.bin/talk/invite.c
+++ usr.bin/talk/invite.c
@@ -77,13 +77,9 @@
itimer.it_interval = itimer.it_value;
if (listen(sockt, 5) != 0)
p_error("Error on attempt to listen for caller");
-#ifdef MSG_EOR
/* copy new style sockaddr to old, swap family (short in old) */
- msg.addr = *(struct osockaddr *)&my_addr; /* XXX new to old style*/
+ msg.addr = *(struct tsockaddr *)&my_addr;
msg.addr.sa_family = htons(my_addr.sin_family);
-#else
- msg.addr = *(struct sockaddr *)&my_addr;
-#endif
msg.id_num = htonl(-1); /* an impossible id_num */
invitation_waiting = 1;
announce_invite();
Index: usr.bin/talk/look_up.c
===================================================================
--- usr.bin/talk/look_up.c
+++ usr.bin/talk/look_up.c
@@ -59,13 +59,9 @@
struct sockaddr addr;
/* the rest of msg was set up in get_names */
-#ifdef MSG_EOR
/* copy new style sockaddr to old, swap family (short in old) */
- msg.ctl_addr = *(struct osockaddr *)&ctl_addr;
+ msg.ctl_addr = *(struct tsockaddr *)&ctl_addr;
msg.ctl_addr.sa_family = htons(ctl_addr.sin_family);
-#else
- msg.ctl_addr = *(struct sockaddr *)&ctl_addr;
-#endif
/* must be initiating a talk */
if (!look_for_invite(rp))
return (0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 25, 12:12 AM (2 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30235952
Default Alt Text
D14505.id39712.diff (3 KB)
Attached To
Mode
D14505: Use a private definition of osockaddr rather then relying on type namespace polution in sys/socket.h.
Attached
Detach File
Event Timeline
Log In to Comment