- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- DLPI - can't collect mac addresses in 64-bit
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 06:24 AM
08-14-2015 06:24 AM
DLPI - can't collect mac addresses in 64-bit
Hello
I try to collect MAC addresses on HP-UX. There are 2 MAC addresses (lan0 and lan1) on my test machine (HP integrity server, HP-UX itanium V2).
I first send attach requests with ppa 0 and 1, and then use the DLPI primitives DL_PHYS_ADDR_REQ and DL_PHYS_ADDR_ACK to collect the physical addresses.
The program works well when compiled in 32-bit, but both requests (with ppa=0 and ppa=1) return the same physical address when the program is 64-bit.
Any idea why I can't collect the 2 MAC addresses on 64-bit?
Your help will be greatly appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2015 06:04 AM
08-15-2015 06:04 AM
Re: DLPI - can't collect mac addresses in 64-bit
> Your help will be greatly appreciated.
You first. Do you _really_ expect advice on a program when only
_you_ (and some psychics?) can see either the program source or how you
built the executable from it?
> Any idea why I can't collect the 2 MAC addresses on 64-bit?
I'd guess some kind of programming error, possibly involving 32-bit
versus 64-bit storage. Without some actual information, that's about
the best I can do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2015 07:32 AM
08-16-2015 07:32 AM
Re: DLPI - can't collect mac addresses in 64-bit
Thank you for you reply.
I am sorry but I don't have the sources right now. Basically, I followed the examples of DLPI documentation.
http://h10032.www1.hp.com/ctg/Manual/c02011471.pdf (p 188):
/* Attach to the PPA */ dl_attach_req.dl_primitive = DL_ATTACH_REQ; dl_attach_req.dl_ppa = 0; /* in 64-bit, I get the same phyical address with ppa = 1 */ ctlbuf.len = sizeof (dl_attach_req); ctlbuf.buf = (char *) &dl_attach_req; flags = RS_HIPRI; printf("Sending a DL_ATTACH_REQ primitive\n"); if (putmsg(fd, &ctlbuf, (struct strbuf*) NULL, flags) < 0) { perror("main: putmsg"); ctlbuf.buf = buf_ctl; ctlbuf.maxlen = 1000; } if (getmsg(fd, &ctlbuf, (struct strbuf*)NULL, &flags) < 0) { perror("main: getmsg"); recv_primitive = *(int *)buf_ctl; /* If DL_OK_ACK is received, attach was successful */ if (recv_primitive != DL_OK_ACK) { printf("Could not attach\n"); exit(1); } } /* Request phyical Address */ dl_addr_req.dl_primitive = DL_PHYS_ADDR_REQ; dl_addr_req.dl_addr_type = DL_CURR_PHYS_ADDR; ctlbuf.len = sizeof (dl_addr_req); ctlbuf.buf = (char *) &dl_addr_req; flags = RS_HIPRI; printf("Sending a DL_PHYS_ADDR_REQ primitive\n"); if (putmsg(fd, &ctlbuf, (struct strbuf*) NULL, flags) < 0) { perror("main: putmsg"); ctlbuf.buf = buf_ctl; ctlbuf.maxlen = 1000; } if (getmsg(fd, &ctlbuf, (struct strbuf*)NULL, &flags) < 0) { perror("main: getmsg"); recv_primitive = *(int *)buf_ctl; if (recv_primitive != DL_OK_ACK) { printf("Could not find phyical address\n"); exit(1); } } /*show the result : the phyical address is stored in position 3,4 in 32 bit, and 1, 16 in 64 bit. I get different values when I change the ppa in 32-bit. In 64 bit however, the ppa has no effect: I can get only 1 physical address. */ for (i = 0; i < 16, i++) { printf("%d : %d", i, (ulong)ctlbuf.buf[i]); } /* close & exit */ close(fd);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2015 12:29 PM
08-16-2015 12:29 PM
Re: DLPI - can't collect MAC addresses in 64-bit
Do you get any warnings when you compile for 64 bit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2015 05:51 PM - edited 08-16-2015 05:53 PM
08-16-2015 05:51 PM - edited 08-16-2015 05:53 PM
Re: DLPI - can't collect MAC addresses in 64-bit
only one warning:
warning: use of C99 long long integer constant
but not on the file where containing the code to get the physical address..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2015 01:03 AM
08-17-2015 01:03 AM
Re: DLPI - can't collect mac addresses in 64-bit
> I'd guess some kind of programming error, possibly involving 32-bit versus 64-bit storage.
Quick hint, but you were right. That was about ulong type which seems to have different size in 64-bit.
The solution was to use:
(u_char *)ctrl_area + addr_ack->dl_addr_offset;
(inspired from the 'Connection Mode Example' example of the DLPI Programmer’s Guide (p 196))
Your help is greatly appreciated ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2015 10:06 AM
08-17-2015 10:06 AM
Re: DLPI - can't collect MAC addresses in 64-bit
>That was about ulong type which has a different size in 64-bit.
Yes, that would be 32 vs 64. Not sure how (u_char*) would replace it, unless it didn't really work in 32 bit mode.