[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RTEMS with multiple IP Address



Hi,
Since I have not seen anyone answer your question, here is a little
function that should add an IP Alias (this works on the current
snapshot).

=================
void addAlias(const char *pName, const char *pAddr, const char *pMask)
{
  struct ifaliasreq      aliasreq;
  struct sockaddr_in    *in;

  /* initialize alias request */
  memset(&aliasreq, 0, sizeof(aliasreq));
  sprintf(aliasreq.ifra_name, pName);

  /* initialize alias address */
  in = (struct sockaddr_in *)&aliasreq.ifra_addr;
  in->sin_family = AF_INET;
  in->sin_len    = sizeof(aliasreq.ifra_addr);
  in->sin_addr.s_addr = inet_addr(pAddr);

  /* initialize alias mask */
  in = (struct sockaddr_in *)&aliasreq.ifra_mask;
  in->sin_family = AF_INET;
  in->sin_len    = sizeof(aliasreq.ifra_mask);
  in->sin_addr.s_addr = inet_addr(pMask);

  /* call to setup the alias */
  rtems_bsdnet_ifconfig(pName, SIOCAIFADDR, &aliasreq);
}
=================

Good Luck,
Mike Siers


-----Original Message-----
From: Pires Claudio [mailto:CPIRES at nec.com.ar]
Sent: Wednesday, January 15, 2003 1:01 PM
To: rtems
Cc: Gonzalez Dardo
Subject: RTEMS with multiple IP Address


Hi guys! Does anybody work with RTEMS and multiple IP address over the same
interface?
I am working on MC360 but any experience would be very appreciated

Claudio Pires
Desarrollo de Software de Gesti?n
Departamento de Desarrollo de Software
NEC ARGENTINA
Av. San Mart?n 5020 - (B1604CDY) Florida
Provincia de Buenos Aires - Rep?blica Argentina
Tel: (54-11) 4730-6000 (Conm.) - (54-11) 4730-6072 (Directo)
Fax: (54-11) 4730-6060
E-mail: cpires at nec.com.ar
<http://www.nec.com.ar/>