There is one difference which I note in the code below. For the kext you use
strcpy(ep_ctl.ctl_name, MYCONTROLNAME);
for the user client, you use
strcpy(info.ctl_name, MYKEXTNAME);
If they are not the same, then the tool will never see the kext.
rich
At 3:00 PM -0700 4/26/06, David A Rowland wrote:
I have an app and a kernel extension that should communicate. It
isn't happening, and I don't know why.
I have adapted the sample code in the Network Kernel Extensions
Programming Guide, 2005-8-11.
The kext loads and registers itself apparently successfully:
issues an ioctl to find out about the kext, again with apparent success:
struct ctl_info info;
memset(&info, 0, sizeof(info));
assert (strlen(MYKEXTNAME) < MAX_KCTL_NAME);
strcpy(info.ctl_name, MYKEXTNAME);
int err;
if (ioctl(fd, CTLIOCGINFO, &info)) {
err = errno;
printf("Could not get ID for kernel control. %d\n", err);
return(err);
}
addr.sc_id = info.ctl_id;
addr.sc_unit = 0;
then it does a connect:
result = connect(fd, (struct sockaddr *)&addr, sizeof(addr));
with no error reported.
However, the EPHandleConnect routine is never called, and when I try
getsockopt and setsockopt, they don't seem to reach the kext either.
I wonder if I am setting the the sc_id in the addr struct correctly.
Has anyone made this sample code work? I'm suspicious of it because
of a number of typos I found.
--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden
This email sent to email@hidden
References:
>Kext control (From: David A Rowland <email@hidden>)