Solution: Unloading network drivers from CLI
Solution: Unloading network drivers from CLI
- Subject: Solution: Unloading network drivers from CLI
- From: Godfrey van der Linden <email@hidden>
- Date: Tue, 10 Nov 2009 14:32:37 +1100
So the problem was that I couldn't load and unload my development
network driver. With Josh's and another's help I have found the magic
incantations for successfully unloading.
For you network developers out there
Cheers
Godfrey
#in your bashrc add
ifclient() { sudo ifconfig en2 inet 192.168.1.2 netmask
0xffffff002 $@; }
nu() { ifclient up; }
nd() { ifclient down delete; sudo ipunplumb; }
// Wrap this in a C file and implement the sys_test macros.
// taken from xnu/sys/sockio.h these are kernel private for some reason
#define SIOCPROTODETACH _IOWR('i', 81, struct ifreq) /* detach proto
from interface */
static void
siocprotodetach(const char *name)
{
int sockfd;
struct ifreq ifr;
sockfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
sys_test(sockfd, "Couldn't open a socket for the protocol detach");
bzero(&ifr, sizeof(ifr));
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
sys_test(ioctl(sockfd, SIOCPROTODETACH, &ifr),
"ioctl failed to detach protocol");
close(sockfd);
}
_______________________________________________
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