Attached is a small I program I created based on ioctl and SIOCGIFCONF. It
works fine on linux 32 bits. 
On 64 bits the record tifmap should be 24 bytes instead of 16. Record
alignment on 64 bits doesn't seem to alright. Using i:=i+40 instead of
i:=i+sizeof(TIFrec); works for 64 bit.
You'll notice that in the function GetLocalIPs I also build the string names
which lists the names of the interfaces. That is for debugging only but
could be used if needed.

Ludo


> -----Message d'origine-----
> De : Sascha-Carsten Wedler [mailto:fxmave...@web.de] 
> Envoyé : mercredi 20 juillet 2011 15:52
> À : Ararat Synapse
> Objet : Re: [Synalist] RE : GetLocalIPs only returns 127.0.01 (Linux)
> 
> 
> Hello Ludo,
> 
> thx for this information and the tipps.
> i think i will try to parse the output of ifconfig...
> i am wondering, that there is no common way without these 
> output-parsing-tricks...
> 
> Greets
>   FX
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: "Ludo Brands" <ludo.bra...@free.fr>
> Gesendet: 20.07.2011 14:09:39
> An: "'Ararat Synapse'" <synalist-public@lists.sourceforge.net>
> Betreff: [Synalist] RE : GetLocalIPs only returns 127.0.01 (Linux)
> 
> >GetLocalIPs on linux is using DNS to resolve the name of your local 
> >machine. In most cases this is not going to return anything. 
> The most 
> >reliable solution would be to parse the output of "ifconfig" or of 
> >"/sbin/ip -o addr". I've seen some samples in C that use ioctl with 
> >SIOCGIFCONF, which is pretty much what ifconfig does, but 
> they are all 
> >rather complicated to implement.
> >
> >Ludo
> >
> >
> >
> >-----Message d'origine-----
> >De : Sascha-Carsten Wedler [mailto:fxmave...@web.de]
> >Envoyé : mercredi 20 juillet 2011 10:57
> >À : synalist-public@lists.sourceforge.net
> >Objet : [Synalist] GetLocalIPs only returns 127.0.01 (Linux)
> >
> >
> >Hello,
> >
> >is there a ay to get the GetLocalIPs function working under 
> linux/fpc? 
> >I testet the last stable and the trunc version, without success. The 
> >function returns 127.0.0.1 only.
> >
> >I'm using Ubuntu 9.04 and FPC 2.4.2 / Lazarus svn
> >
> >Can anyone help?
> >
> >Greets
> > FX
> >
> >
> >
> >Schon gehört? WEB.DE hat einen genialen Phishing-Filter in 
> die Toolbar 
> >eingebaut! http://produkte.web.de/go/toolbar
> >
> >
> >-------------------------------------------------------------
> ----------
> >-------
> >10 Tips for Better Web Security
> >Learn 10 ways to better secure your business today. Topics 
> covered include:
> >Web security, SSL, hacker attacks & Denial of Service (DoS), 
> private keys,
> >security Microsoft Exchange, secure Instant Messaging, and much more.
> >http://www.accelacomm.com/jaw/sfnl/114/51426210/
> >_______________________________________________
> >synalist-public mailing list
> >synalist-public@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/synalist-public
> 
> 
> ___________________________________________________________
> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in 
> die Toolbar eingebaut! http://produkte.web.de/go/toolbar
> 
> --------------------------------------------------------------
> ----------------
> 10 Tips for Better Web Security
> Learn 10 ways to better secure your business today. Topics 
> covered include: Web security, SSL, hacker attacks & Denial 
> of Service (DoS), private keys, security Microsoft Exchange, 
> secure Instant Messaging, and much more. 
> http://www.accelacomm.com/jaw/sfnl/114/51426210/
> _______________________________________________
> synalist-public mailing list synalist-public@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/synalist-public
> 

Attachment: getlocalips.lpr
Description: Binary data

------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to