[olsr-dev] Windows interface naming
(spam-protected)
(spam-protected)
Mon Oct 2 15:37:10 CEST 2006
Glad to have been useful.
Just a little patch for my patch :)
This line:
MiniIndex = WalkerAddr->IfIndex;
MUST be modified with this one:
MiniIndex = WalkerAddr->IfIndex & 0x0f;
Bye
Sektor
---------- Initial Header -----------
>From : (spam-protected)
To : "OLSR development" (spam-protected)
Cc :
Date : Mon, 2 Oct 2006 06:38:11 +1000
Subject : RE: [olsr-dev] Windows interface naming
> Hi Sektor - I've often wondered why myself - I'll use your patch if it
> doesn't make it into the main build. :)
>
> Cheers,
>
> Dan
>
> > -----Original Message-----
> > From: (spam-protected)
> > [mailto:(spam-protected)] On Behalf Of (spam-protected)
> > Sent: Saturday, 23 September 2006 12:46 AM
> > To: olsr-dev
> > Subject: [olsr-dev] Windows interface naming
> >
> > Hi guys,
> > I'm new in this mailing list.
> > I downloaded olsrd software in order to use it under Windows Xp.
> > I think it's a good software in all its parts (core, gui, plugin).
> >
> > I read the note "INTERFACE NAMING" in the readme file and I
> > have just a question: why don't you use the friendly name
> > displayed in the Network Connections Window?
> > The index adapter, used to build the interface name, is not
> > persistent (it changes when you disable/enable an adapter).
> > Moreover if you use a config file to run olsrd you must
> > change the interface name specified in that file.
> >
> > I have developed the following patches for ifnet.c (win32)
> > and Makefile.win32 to enable the use of the friedly name.
> > Please, give me some feedbacks if you think these
> > modifications are good.
> > Bye
> > Sektor
> >
> > --- Makefile.win32 2005-12-29 21:26:32.000000000 +0100
> > +++ Makefile.win32.new 2006-09-22 16:31:10.531080400 +0200
> > @@ -8,7 +8,7 @@
> > SRCS += $(wildcard src/win32/*.c)
> > HDRS += $(wildcard src/win32/*.h)
> >
> > -DEFINES += -DWIN32
> > +DEFINES += -DWIN32 -D_WIN32_WINNT=0x0501
> > LIBS += -mno-cygwin -lws2_32 -liphlpapi
> > INCLUDES += -I$(TOPDIR)/src/win32
> > CFLAGS += -mno-cygwin
> >
> > --- ifnet.c 2005-10-23 21:01:04.000000000 +0200
> > +++ ifnet.c.new 2006-09-22 16:36:22.784856000 +0200
> > @@ -141,6 +141,8 @@
> > unsigned long Res;
> > int TabIdx;
> > IP_ADAPTER_INFO AdInfo[MAX_INTERFACES], *Walker;
> > + IP_ADAPTER_ADDRESSES AdAddr[MAX_INTERFACES], *WalkerAddr; char
> > + FriendlyName[MAX_INTERFACE_NAME_LEN];
> >
> > if (olsr_cnf->ip_version == AF_INET6)
> > {
> > @@ -148,10 +150,39 @@
> > return -1;
> > }
> >
> > - if (IntNameToMiniIndex(&MiniIndex, Name) < 0)
> > + if ((Name[0] != 'i' && Name[0] != 'I') ||
> > + (Name[1] != 'f' && Name[1] != 'F'))
> > {
> > - fprintf(stderr, "No such interface: %s!\n", Name);
> > - return -1;
> > + BuffLen = sizeof (AdAddr);
> > +
> > + Res = GetAdaptersAddresses(AF_INET, 0, NULL, AdAddr, &BuffLen);
> > +
> > + if (Res != NO_ERROR)
> > + {
> > + fprintf(stderr, "GetAdaptersAddresses() = %08lx",
> > GetLastError());
> > + return -1;
> > + }
> > + for (WalkerAddr = AdAddr; WalkerAddr != NULL;
> > WalkerAddr = WalkerAddr->Next)
> > + {
> > + OLSR_PRINTF(5, "Index = %08x - ", (int)WalkerAddr->IfIndex);
> > + wcstombs(FriendlyName, WalkerAddr->FriendlyName,
> > MAX_INTERFACE_NAME_LEN);
> > + OLSR_PRINTF(5, "Friendly name = %s\n", FriendlyName);
> > + if (strncmp(FriendlyName, Name,
> > MAX_INTERFACE_NAME_LEN) == 0)
> > + break;
> > + }
> > + if (WalkerAddr == NULL)
> > + {
> > + fprintf(stderr, "No such interface: %s!\n", Name);
> > + return -1;
> > + }
> > + MiniIndex = WalkerAddr->IfIndex;
> > + } else
> > + {
> > + if (IntNameToMiniIndex(&MiniIndex, Name) < 0)
> > + {
> > + fprintf(stderr, "No such interface: %s!\n", Name);
> > + return -1;
> > + }
> > }
> >
> > IfTable = (MIB_IFTABLE *)Buff;
> >
> >
> >
> > _______________________________________________
> > olsr-dev mailing list
> > (spam-protected)
> > https://www.olsr.org/mailman/listinfo/olsr-dev
> >
>
>
> _______________________________________________
> olsr-dev mailing list
> (spam-protected)
> https://www.olsr.org/mailman/listinfo/olsr-dev
>
------------------------------------------------------
Mutuo da 200.000? Spread scontati da +0.69%. Solo per richieste online. www.mutuionline.it
http://click.libero.it/mutuionline
More information about the Olsr-dev
mailing list