1
0
mirror of https://github.com/solemnwarning/ipxwrapper synced 2024-12-30 16:45:37 +01:00

Store IPX net/node numbers in ipx_net structure during startup.

This commit is contained in:
Daniel Collins 2011-04-24 00:01:38 +00:00
parent 4afad85e3c
commit b11036bc14
2 changed files with 17 additions and 8 deletions

View File

@ -126,12 +126,23 @@ BOOL WINAPI DllMain(HINSTANCE me, DWORD why, LPVOID res) {
return FALSE;
}
INIT_NIC(nnic);
nnic->ipaddr = ntohl(inet_addr(ifptr->IpAddressList.IpAddress.String));
nnic->bcast = nnic->ipaddr | ~ntohl(inet_addr(ifptr->IpAddressList.IpMask.String));
memcpy(nnic->hwaddr, ifptr->Address, 6);
if(got_rv) {
memcpy(nnic->ipx_net, rv.ipx_net, 4);
memcpy(nnic->ipx_node, rv.ipx_node, 6);
}else{
unsigned char net[] = {0,0,0,1};
memcpy(nnic->ipx_net, net, 4);
memcpy(nnic->ipx_node, nnic->hwaddr, 6);
}
nnic->next = NULL;
if(got_rv && rv.primary) {
/* Force primary flag set, insert at start of NIC list */
nnic->next = nics;

View File

@ -59,12 +59,6 @@
(ptr)->src_socket = 0;\
(ptr)->size = 0;
#define INIT_NIC(ptr) \
(ptr)->ipaddr = 0;\
(ptr)->bcast = 0;\
memset((ptr)->hwaddr, 0, 6);\
(ptr)->next = NULL;
#define INIT_HOST(ptr) \
memset((ptr)->hwaddr, 0, 6);\
(ptr)->ipaddr = 0;\
@ -119,11 +113,15 @@ struct ipx_packet {
} __attribute__((__packed__));
struct ipx_nic {
/* TODO: Remove if not needed for per-interface sockets in the future */
uint32_t ipaddr;
uint32_t bcast;
unsigned char hwaddr[6];
unsigned char ipx_net[4];
unsigned char ipx_node[6];
ipx_nic *next;
};