Skip to content

Commit 2368f88

Browse files
committed
Add support for MCAST_JOIN_GROUP & MCAST_LEAVE_GROUP
1 parent 9d78fbc commit 2368f88

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

include/bits/in.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
#define IP_MULTICAST_LOOP 11 /* i_char; set/get IP multicast loopback */
4747
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
4848
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
49+
50+
#define MCAST_JOIN_GROUP 19 /* MCAST_JOIN_GROUP is protocol independent */
51+
#define MCAST_LEAVE_GROUP 22
52+
4953
#if 0 /* not yet supported or defined */
5054
#define IP_UNBLOCK_SOURCE 14 /* ip_mreq_source: unblock data from source */
5155
#define IP_BLOCK_SOURCE 15 /* ip_mreq_source: block data from source */
@@ -124,14 +128,6 @@ struct ip_opts
124128
char ip_opts[40]; /* Actually variable in size. */
125129
};
126130

127-
/* Like `struct ip_mreq' but including interface specification by index. */
128-
struct ip_mreqn
129-
{
130-
struct in_addr imr_multiaddr; /* IP multicast address of group */
131-
struct in_addr imr_address; /* local IP address of interface */
132-
int imr_ifindex; /* Interface index */
133-
};
134-
135131
/* Structure used for IP_PKTINFO. */
136132
struct in_pktinfo
137133
{

include/bits/socket.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ struct sockaddr
174174
char sa_data[14]; /* Address data. */
175175
};
176176

177+
178+
#if 0
177179
/* Structure large enough to hold any socket address (with the historical
178180
exception of AF_UNIX). We reserve 128 bytes. */
179181
#define __ss_aligntype unsigned long int
@@ -186,7 +188,22 @@ struct sockaddr_storage
186188
__ss_aligntype __ss_align; /* Force desired alignment. */
187189
char __ss_padding[_SS_PADSIZE];
188190
};
191+
#endif
192+
193+
/*
194+
* Desired design of maximum size and alignment.
195+
*/
196+
#define _SS_MAXSIZE 128
197+
#define _SS_ALIGNSIZE sizeof(unsigned short)
189198

199+
#define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (sa_family_t)) % _SS_ALIGNSIZE)
200+
#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
201+
202+
struct sockaddr_storage {
203+
sa_family_t ss_family;
204+
char __ss_pad1[_SS_PAD1SIZE];
205+
unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
206+
};
190207

191208
/* Bits in the FLAGS argument to `send', `recv', et al. */
192209
enum

include/netinet/in.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,15 @@ struct ip_mreq_source
295295
/* IP address of source. */
296296
struct in_addr imr_sourceaddr;
297297
};
298+
299+
/* Like `struct ip_mreq' but including interface specification by index. */
300+
struct ip_mreqn
301+
{
302+
struct in_addr imr_multiaddr; /* IP multicast address of group */
303+
struct in_addr imr_address; /* local IP address of interface */
304+
int imr_ifindex; /* Interface index */
305+
};
306+
298307
#endif
299308

300309
#if !__USE_KERNEL_IPV6_DEFS

include/sockios.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,13 @@
5656
#define SIOCGARP (('S' << 8) | 41) /* get ARP table entry */
5757
#define SIOCSARP (('S' << 8) | 42) /* set ARP table entry */
5858

59+
#ifdef __USE_GNU
60+
61+
#ifdef SIOCGIFNAME
62+
#undef SIOCGIFNAME
63+
#define SIOCGIFNAME SIOCGIFNAME_ETH
64+
#endif
65+
66+
#endif
67+
5968
#endif /* _SOCKIOS_H */

0 commit comments

Comments
 (0)