changeing the IP address
Dominique Bastien
Dominique.Bastien at abl.ca
Tue May 23 10:28:15 UTC 2000
you need to pass via the ioctl function :
#define satosin(sa) ((struct sockaddr_in *) (sa))
struct ifreq IntRequest;
// Set new IP address.
IntRequest.ifr_ifno = PortIndex;
satosin(&IntRequest.ifr_addr)->sin_family = AF_INET;
satosin(&IntRequest.ifr_addr)->sin_addr.s_addr = htonl( NiIPAddr );
ioctl ( MySocket, SIOCSIFADDR, (char *)&IntRequest );
// Set new Network Mask.
IntRequest.ifr_ifno = PortIndex;
satosin(&IntRequest.ifr_addr)->sin_family = AF_INET;
satosin(&IntRequest.ifr_addr)->sin_addr.s_addr = htonl( NiNetMask );
ioctl ( MySocket, SIOCSIFNETMASK, (char *)&IntRequest );
p.s. to program the IP stack and other network component you can read
Richard Stevens, he
made a realy good job in his books.
Dominique Bastien
> -----Message d'origine-----
> De: 320094152587-0001 at t-online.de [SMTP:320094152587-0001 at t-online.de]
> Date: 22 mai 2000 12:04
> À: RTEMS List
> Objet: changeing the IP address
>
> Is it possible to change the IP address (, netmask and gateway)
> from a running system without reboot (re-init) ?
>
> I only found a reference on setting up the address at init time
> but don't realy understand if the same thing should be used
> for reconfiguration at runtime.
>
> TIA,
> Erwin
>
> --
> Q - S O F T - E N G I N E E R I N G
> Rodachtalweg 11, 81549 Muenchen, Germany
>
> Erwin Rol (Software Engineer) phone: +49-89-68050051
> Erwin.Rol at Q-Soft-Engineering.com fax : +49-89-68050052
More information about the users
mailing list