site_archiver(a)lists.apple.com
Delivered-To: darwin-kernel(a)lists.apple.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=P3gPoHh3O2FXP1CadHmWmnURKs9H9XcwAwK/ata+7e4=; b=Ne/zsJGC5iTSt4r8E8LAYWkyqknNcxUaMltzmsBk2/Phy/VEPXUgiQO6BFRuMBiTnk dqzIo4SPy3cej9QgtqNnsjxxWAqtOVV2lcuVhFrqjZow4A1H48BReSG4hJUHh9wQKSZc bp1+YmCRid4X7x1zXFC+ibFGD2NHv1Nn8M8ps=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=CRbFyQ5Unlq0KHVfO3C04si4PvltLPYvAwnc1G6UgFu1zfB5/8PUhb58Q5eNIh+8Rr TNXoBbIvt7XkHFDfQgNByVFLIyTSfDedeBHcU1UiXKMg6qP1QrHiJ4oLMlUyXGqUDlBA 9ocqHfGN8pm2IriWwkwnPJO2Dr8TiZsSP3eow=
SIOCGIFKPI sounds like an interface ioctl, which the socket level
filter may not be receiving. And looking at where the ioctl call ends
up (the IOCGROUP for SIOCGIFKPI is 'i' for 'interface'):
ioctl
soioctl
/* Call the socket filter's ioctl handler for most ioctls */
if (IOCGROUP(cmd) != 'i' && IOCGROUP(cmd) != 'r') { ... }
...
ifioctllocked
ifioctl
ifp = ifunit(ifr->ifr_name);
if (ifp == 0) return ENXIO;
...
if (cmd == SIOCSIFKPI) {... }
...
ifnet_ioctl(...)
it looks like that SIOCSIFKPI is strictly handled by interface code
(and filters).
You can just use getsockopt instead, for a SOL_SOCKET option. I can
provide some example code but it should be straightforward.
Off topic perhaps, but if you've solved the issue of making sure a
socket doesn't get detached while you're calling sock_xyz() from your
kext (outside a sflt callback), I'd be interested in finding out how.
HTH,
Bogdan
On Sat, Sep 4, 2010 at 2:07 PM, Matt Slot <apple_lists(a)mattslot.com> wrote:
> ioctl(tcpSocket, SIOCGIFKPI, &myreq);
>
> The last call is failing with ENXIO, and I never see the ioctl() come through.
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (Darwin-kernel(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.…
This email sent to site_archiver(a)lists.apple.com
site_archiver(a)lists.apple.com
Delivered-To: darwin-kernel(a)lists.apple.com
I have an NKE that installs a control socket and a socket filter. I have a userland process which opens a control connection, and receives incoming TCP connections. I'd like to pass up some per-socket data to the userland process
The easiest way would be to write the data to the TCP stream on connect, but I'd prefer to pass it up "out of band" if possible. I looked at ioctl(SIOCGIFKPI), but I'm completely at a loss at how to make it work.
int controlSocket = -1;
controlSocket = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL);
struct ctl_info controlInfo = {0};
strcpy(controlInfo.ctl_name, MY_KEXT_BUNDLEID);
ioctl(controlSocket, CTLIOCGINFO, &controlInfo);
struct ifreq myreq = {0};
myreq.ifr_ifru.ifru_kpi.ifk_module_id = controlInfo.ctl_id;
myreq.ifr_ifru.ifru_kpi.ifk_type = 1;
int tcpSocket = myAcceptTCPConnection();
ioctl(tcpSocket, SIOCGIFKPI, &myreq);
The last call is failing with ENXIO, and I never see the ioctl() come through.
Thanks,
Matt _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (Darwin-kernel(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.…
This email sent to site_archiver(a)lists.apple.com