Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - IOCTL commands for setting MAC and IP addresses: (2 Items)
   
IOCTL commands for setting MAC and IP addresses  
Hello,

I have a TAP interface and wish to override the default MAC and assign a IP address. What ioctl commands are available 
in QNX to support this. 
I saw a few posts around SIOCSIFADDR. Not sure if this is used for both of the above cases. Will 'ifru_addr' be used for
 setting both addresses?
--------------------------------------------------------------------
struct	ifreq {
	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
	union {
		struct	sockaddr ifru_addr;
		struct	sockaddr ifru_dstaddr;
		struct	sockaddr ifru_broadaddr;
		struct	sockaddr_storage ifru_space;
#ifndef __QNXNTO__
		short	ifru_flags;
#else
		int	ifru_flags;
#endif
		int	ifru_metric;
		int	ifru_mtu;
		int	ifru_dlt;
		unsigned int	ifru_value;
		void *	ifru_data;
		struct {
			uint32_t	b_buflen;
			void		*b_buf;
		} ifru_b;
#ifdef __QNXNTO__
		int ifru_fibmask;
#endif
	} ifr_ifru;
--------------------------------------------------
Re: IOCTL commands for setting MAC and IP addresses  
> Hello,
> 
> I have a TAP interface and wish to override the default MAC and assign a IP 
> address. What ioctl commands are available in QNX to support this. 
> I saw a few posts around SIOCSIFADDR. Not sure if this is used for both of the
>  above cases. Will 'ifru_addr' be used for setting both addresses?
> --------------------------------------------------------------------
> struct	ifreq {
> 	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
> 	union {
> 		struct	sockaddr ifru_addr;
> 		struct	sockaddr ifru_dstaddr;
> 		struct	sockaddr ifru_broadaddr;
> 		struct	sockaddr_storage ifru_space;
> #ifndef __QNXNTO__
> 		short	ifru_flags;
> #else
> 		int	ifru_flags;
> #endif
> 		int	ifru_metric;
> 		int	ifru_mtu;
> 		int	ifru_dlt;
> 		unsigned int	ifru_value;
> 		void *	ifru_data;
> 		struct {
> 			uint32_t	b_buflen;
> 			void		*b_buf;
> 		} ifru_b;
> #ifdef __QNXNTO__
> 		int ifru_fibmask;
> #endif
> 	} ifr_ifru;
> --------------------------------------------------
Hi All,
  I have similar request for 
1) I cloned "/dev/tap/ and gone tap0 created. Now how to rename tap0 to other name or add a link with other name?
2) I used command " ifconfig tap0 link 96:9f:b5:4a:3d:4c active" to associate this new MAC address and make it as active
 this MAC address and old one as in active.I searched in net for code logic, but not able to find useful info.
How to achieve this via code?
3)  I used  command "dhcp.client -i tap0" for configuring IP address. 
How to achieve this via code?
4) Do we have any IOCTL commands sample code or any other way via code for the above requests?

Please help in achieving this