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:
parent
4afad85e3c
commit
b11036bc14
@ -126,12 +126,23 @@ BOOL WINAPI DllMain(HINSTANCE me, DWORD why, LPVOID res) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_NIC(nnic);
|
|
||||||
|
|
||||||
nnic->ipaddr = ntohl(inet_addr(ifptr->IpAddressList.IpAddress.String));
|
nnic->ipaddr = ntohl(inet_addr(ifptr->IpAddressList.IpAddress.String));
|
||||||
nnic->bcast = nnic->ipaddr | ~ntohl(inet_addr(ifptr->IpAddressList.IpMask.String));
|
nnic->bcast = nnic->ipaddr | ~ntohl(inet_addr(ifptr->IpAddressList.IpMask.String));
|
||||||
|
|
||||||
memcpy(nnic->hwaddr, ifptr->Address, 6);
|
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) {
|
if(got_rv && rv.primary) {
|
||||||
/* Force primary flag set, insert at start of NIC list */
|
/* Force primary flag set, insert at start of NIC list */
|
||||||
nnic->next = nics;
|
nnic->next = nics;
|
||||||
|
@ -59,12 +59,6 @@
|
|||||||
(ptr)->src_socket = 0;\
|
(ptr)->src_socket = 0;\
|
||||||
(ptr)->size = 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) \
|
#define INIT_HOST(ptr) \
|
||||||
memset((ptr)->hwaddr, 0, 6);\
|
memset((ptr)->hwaddr, 0, 6);\
|
||||||
(ptr)->ipaddr = 0;\
|
(ptr)->ipaddr = 0;\
|
||||||
@ -119,11 +113,15 @@ struct ipx_packet {
|
|||||||
} __attribute__((__packed__));
|
} __attribute__((__packed__));
|
||||||
|
|
||||||
struct ipx_nic {
|
struct ipx_nic {
|
||||||
|
/* TODO: Remove if not needed for per-interface sockets in the future */
|
||||||
uint32_t ipaddr;
|
uint32_t ipaddr;
|
||||||
uint32_t bcast;
|
uint32_t bcast;
|
||||||
|
|
||||||
unsigned char hwaddr[6];
|
unsigned char hwaddr[6];
|
||||||
|
|
||||||
|
unsigned char ipx_net[4];
|
||||||
|
unsigned char ipx_node[6];
|
||||||
|
|
||||||
ipx_nic *next;
|
ipx_nic *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user