Sponsored Content
Full Discussion: SCO get MAC Address
Top Forums Programming SCO get MAC Address Post 302106111 by jim mcnamara on Tuesday 6th of February 2007 03:38:34 PM
Old 02-06-2007
does this work?
Code:
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>


int main( int argc, char *argv[] )
{
	int s;
		
	struct ifreq buffer;
	s = socket(PF_INET, SOCK_DGRAM, 0);
	memset(&buffer, 0x00, sizeof(buffer));
	strcpy(buffer.ifr_name, "eth0");
	ioctl(s, SIOCGIFHWADDR, &buffer);
	close(s);	
	for( s = 0; s < 6; s++ )
	{
		printf("%.2X ", (unsigned char)buffer.ifr_hwaddr.sa_data[s]);
	}
	printf("\n");

	return 0;
}

 

10 More Discussions You Might Find Interesting

1. Programming

Get Mac Address

:( Hi I am trying to get Mac address of of my Sun server from my C program running on the host machine. Any suggestions . (1 Reply)
Discussion started by: ss_hpov
1 Replies

2. UNIX for Dummies Questions & Answers

Mac address

Hi Can some one help me How do find out Mac address in Tru64 Unix Thank you (1 Reply)
Discussion started by: Syed_45
1 Replies

3. IP Networking

How to Achive IP address through MAC(Ethernet) address

Hi sir, i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address....... but i'm nt getting that how i can pass the MAC address to Frame........ Please give me an idea for making such program... Thanks & regards Krishna (3 Replies)
Discussion started by: krishnacins
3 Replies

4. Solaris

Host ID vs MAC Address

Hi, I've got a Sun Solaris machine with host ID (840f8e57) and MAC address (0:14:4f:f:8e:57), how do I: 1. Write the MAC address in standard (IEEE 802) format, i.e. xx-xx-xx-xx-xx-xx? Do I need to add 0's before or after the 'f', i.e. 00-14-4f-0f-8e-57 or 00-14-4f-f0-8e-57? 2. What is... (4 Replies)
Discussion started by: TheBlueSky
4 Replies

5. Solaris

Get ip address from mac address

I have following message in my messages file on solaris 10 WARNING: e1000g3712000:3 has duplicate address 010.022.196.011 (in use by 00:50:56:85:25:ef); disabled Now is there any way i can find which server has 00:50:56:85:25:ef mac address either IP or Hostname ? (6 Replies)
Discussion started by: fugitive
6 Replies

6. SCO

MAC address

hi every one please help i want to change mac address in sco unix 5.0.6 how can i do this (3 Replies)
Discussion started by: kaydream
3 Replies

7. IP Networking

Tracing a MAC address to IP address: Solaris

Hi there I lost connectivity to one of our remote systems and when I checked the messages log I found the following: Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1 Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies

8. SCO

Changing MAC address in SCO 5.0.6

Hi, For som reason i need to change MAC address of SCO Open Server 5.0.6. I have searched foe answer too much but i didn't fin any thing well.:mad: Please help me, Thx:cool::) (4 Replies)
Discussion started by: mammut3d
4 Replies

9. Shell Programming and Scripting

GREP mac address

Hi, mac.txt My mac address is <Mac Address>. How can i replace <Mac Address> with the actual of my computer? I try to GREP command as below but i am unable to grep it to replace just <Mac Address>. ifconfig eth0 | grep -o -E '(]{1,2}:){5}]{1,2}' Million in Advance. Please use... (7 Replies)
Discussion started by: derrickyee81
7 Replies

10. IP Networking

MAC Address - Four Interfaces with the same MAC Address

four interfaces with ifconfig all interfaces have the same mac. If is not set for unique. but it still works. what difference does it make to have all macs the same or different? (4 Replies)
Discussion started by: rrodgers
4 Replies
te(7)							 Miscellaneous Information Manual						     te(7)

NAME
te - TGEC Ethernet interface SYNOPSIS
config_driver te DESCRIPTION
The te interface provides access to a 10 Mb/s Ethernet network through the TGEC controller. The host's Internet address is specified at boot time with an SIOCSIFADDR ioctl. The te interface employs the address resolution protocol described in arp(7) to map dynamically between Internet and Ethernet addresses on the local network. The SIOCSPHYSADDR ioctl can be used to change the physical address of the TGEC. The SIOCRPHYSADDR ioctl can be used to read the physical address of the TGEC. The SIOCADDMULTI and SIOCDELMULTI ioctls can be used to add or delete multicast addresses. The TGEC recognizes a maximum of 12 multicast addresses. The SIOCRDCTRS and SIOCRDZCTRS ioctls can be used to read or ``read and clear'' the Ethernet driver counters. The argument to these two ioctls is a pointer to a counter structure, ctrreq, found in <net/if.h>. The SIOCENABLBACK and SIOCDISABLBACK ioctls can be used to enable and disable the interface loopback mode respectively. EXAMPLES
To obtain the physical address of the adapter, use the SIOCRPHYSADDR ioctl as in the following program example: #include <stdio.h> /* standard I/O */ #include <errno.h> /* error numbers */ #include <sys/socket.h> /* socket definitions */ #include <sys/ioctl.h> /* ioctls */ #include <net/if.h> /* generic interface structures */ main() { int s,i; struct ifdevea devea; /* Get a socket */ s = socket(AF_INET,SOCK_DGRAM,0); if (s < 0) { perror("socket"); exit(1); } strcpy(devea.ifr_name,"te0"); if (ioctl(s,SIOCRPHYSADDR,&devea) < 0) { perror(&devea.ifr_name[0]); exit(1); } printf("Address is "); for (i = 0; i < 6; i++) printf("%X ", devea.default_pa[i] & 0xff); printf(" "); close(s); } To enable external loopback, use the SIOCENABLEBACK ioctl as in the following program example: #include <stdio.h> /* standard I/O */ #include <errno.h> /* error numbers */ #include <sys/socket.h> /* socket definitions */ #include <sys/ioctl.h> /* ioctls */ #include <net/if.h> /* generic interface structures */ main() { int s; struct ifreq data; /* Get a socket */ s = socket(AF_INET,SOCK_DGRAM,0); if (s < 0) { perror("socket"); exit(1); } strcpy(data.ifr,"te0"); if (ioctl(s,SIOCENABLEBACK,&data) < 0) { perror("SIOCENABLEBACK:"); exit(1); } close(s); } ERRORS
The diagnostic error messages contain relevant information provided by the TGEC. The interface was handed a message with addresses format- ted in an unsuitable address family, and the packet was dropped. The TGEC hardware failed to reset itself properly. The driver's attempt to allocate a buffer failed. The driver's attempt to allocate a buffer failed. Too many multicast requests have been made. The shared memory block for the TGEC's local RAM buffer is missing from the CMOS configuration data. RELATED INFORMATION
arp(7), inet(7), netintro(7) delim off te(7)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy