Re: NKE failing on ctl_register call
Re: NKE failing on ctl_register call
- Subject: Re: NKE failing on ctl_register call
- From: Vincent Lubet <email@hidden>
- Date: Tue, 15 Feb 2005 21:50:11 -0800
What version of Mac OS X is this happening on?
Vincent
On Feb 14, 2005, at 8:59 AM, Carl Smith wrote:
I am writing a NKE following some of the example/text given in the
'About Network
Kernel Extensions' document, along with following some code from an
example I found
here on this forum along with some code from the tcplog example.
My problem is that on the call 'ctl_register' I am getting a return
value of (22)
from the ctl_register call and according to the documentation
ctl_register should
return a 0 on success. And in turn from my client app when I try to
'connect' to
this NKE of mine it is failing, with an errno of 1.
So I am assuming something is wrong with my ctl_register call. I load
my kext using
'sudo kextload -v mynke.kext'. I am originally signed in as 'admin'.
Not sure if
this means anything.
Below is a portion of the code, from my NKE, that I am using to try
and register
my NKE.
Does the ctl_id have anything to do with it? I did register it but do
I have to do
anything special with/to the kernel? I am also using the same ID in
my client side.
"kern_return_t ClientKern103_start (kmod_info_t * ki, void * d)
{
int nReturn = 0;
struct kern_ctl_reg AFctl_reg;
bzero(&AFctl_reg, sizeof(AFctl_reg));
AFctl_reg.ctl_id = AFMAC_KERN_ID;
AFctl_reg.ctl_unit = 0;
AFctl_reg.ctl_flags = CTL_FLAG_PRIVILEGED;
AFctl_reg.ctl_sendsize = 0;
AFctl_reg.ctl_recvsize = 0;
// Dispatch functions
// ==================
AFctl_reg.ctl_connect = AFKernConnect;
AFctl_reg.ctl_disconnect = AFKernDisconnect;
AFctl_reg.ctl_write = AFClientKernXWrite;
AFctl_reg.ctl_set = NULL;
AFctl_reg.ctl_get = AFKernGet;
static kern_ctl_ref ctlref = 0; /* Reference of the kernel
controller */
nReturn = ctl_register(&AFctl_reg, 0, &ctlref);
if(nReturn != 0)
{
if(nReturn == EINVAL)
printf("Kernel Register failed");
else
printf("Kernel Register failed with the
error (%d)\n", nReturn);
}
return KERN_SUCCESS;
}
"
I am not looking to anything fancy, yet, I am just trying to get the
communication
going between my NKE and my client.
Any help/suggestions/example code would greatly be appreciated.
Thank You
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.853 / Virus Database: 581 - Release Date: 2/1/2005
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden