Fixed
Status Update
Comments
en...@google.com <en...@google.com>
an...@gmail.com <an...@gmail.com> #2
Andy feedback?
en...@google.com <en...@google.com> #3
ip_mreq_source does seem to be defined in the glibc way by an RFC too: http://www.apps.ietf.org/rfc/rfc3678.html
ccross: any chance of getting these changed in uapi? otherwise i guess we can add another #define-equivalent to the cleanup script to rename the kernel's ip_mreq_source struct out of the way and then just define it ourselves.
ccross: any chance of getting these changed in uapi? otherwise i guess we can add another #define-equivalent to the cleanup script to rename the kernel's ip_mreq_source struct out of the way and then just define it ourselves.
cc...@google.com <cc...@google.com> #4
I doubt upstream would be receptive to changing it, because it would break anybody who was using the uapi linux/in.h header as it is today. I think we'll need a way in general to deal with places the Linux userspace API is not exactly what we want to export as the libc API.
en...@google.com <en...@google.com> #5
yeah, we already either use #define in the headers or some simple rewriting rules in the script to deal with things like this. we appear to have no references to ip_mreq_source in the tree so we can probably get away with this one easily enough.
actually, we have very little in the script at the moment, and they're a lot more general than what we're talking about here (i'm sure it didn't used to be this clean):
kernel_arch_token_replacements = {
"aarch64": {},
"arm": {},
"mips": {"off_t":"__kernel_off_t"},
"x86": {},
}
# Replace tokens in the output according to this mapping
kernel_token_replacements = {
"asm": "__asm__",
"__unused": "__linux_unused", # The kernel usage of __unused conflicts with the macro defined in sys/cdefs.h
}
so maybe i should do this with #define in <netinet/in.h>...
actually, we have very little in the script at the moment, and they're a lot more general than what we're talking about here (i'm sure it didn't used to be this clean):
kernel_arch_token_replacements = {
"aarch64": {},
"arm": {},
"mips": {"off_t":"__kernel_off_t"},
"x86": {},
}
# Replace tokens in the output according to this mapping
kernel_token_replacements = {
"asm": "__asm__",
"__unused": "__linux_unused", # The kernel usage of __unused conflicts with the macro defined in sys/cdefs.h
}
so maybe i should do this with #define in <netinet/in.h>...
en...@google.com <en...@google.com> #7
en...@google.com <en...@google.com> #8
rebased and merged today (now external/iproute2 has been updated to not conflict). this should be fixed in NDK r17.
Description
the relevant part of my code is:
struct ip_mreq_source mreq;
/* Set up the connection to the group */
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
mreq.imr_multiaddr.s_addr = inet_addr(mcast_group);
mreq.imr_sourceaddr.s_addr = inet_addr(ssm_source);
After digging in the issue, i noted a big difference between the way the struct ip_mreq_source is declared in windows/linux and android.
on windows (winsock) and linux (netinit/in.h) the structs for setting up multicast requests and source specific multicasts requests are defined as follow:
struct ip_mreq {
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
struct ip_mreq_source {
struct in_addr imr_multiaddr;
struct in_addr imr_sourceaddr;
struct in_addr imr_interface;
};
on bionic instead, inside of linux/in.h we have the following:
struct ip_mreq {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
};
struct ip_mreq_source {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__be32 imr_multiaddr;
__be32 imr_interface;
__be32 imr_sourceaddr;
};
as you can see ip_mreq is perfectly the same (and compatible) while for some reasons, ip_mreq_source is not.
ip_mreq_source should be re-defined as:
struct ip_mreq_source {
struct in_addr imr_multiaddr;
struct in_addr imr_sourceaddr;
struct in_addr imr_interface;
};