• Re: How to retrieve Ethernet interface status

    From raghumtech@gmail.com@110:300/1.1 to All on Tue Jun 26 11:04:49 2012
    On Sunday, 4 May 2008 11:30:30 UTC+5:30, vs wrote:
    On 2 =D0=BC=D0=B0=D0=B9, 22:17, love.for....@gmail.com wrote:
    On Apr 24, 8:32 am, emb...@online.ru wrote:

    Dear colleagues,

    On LynxOS 4.0 how can I know from the application if the ethernet interface is up or down? ioctl with SIOCGIFFLAGS always returns that
    link is up. Same info printed by ifconfig.

    Ethernet driver definitely has this info but it does not export it in
    any way out: SIOCGIFFLAGS is not processed by the driver_ioctl
    routine. There's always a way to patch the driver but i would prefer
    some 'legal' way.

    Thanks to everybody who helps.

    What is the driver you are using ?
    =20
    Both available on MVME-5500: gfec & em

    Here is the solution

    int check_link(unsigned char instance)
    {

    #if 0
    struct ifreq ifr;
    bzero((char *)&ifr, sizeof(struct ifreq));

    strncpy(ifr.ifr_name,"gt1",3);
    ioctl(dev_str[instance].sock_fd,SIOCGIFFLAGS,&ifr);
    if((ifr.ifr_ifru.ifru_flags & IFACE_UP) && (ifr.ifr_ifru.ifru_flags & IFAC=
    E_RUNNING)){
    return 1;
    else
    #endif
    return 1;
    }

    --- MBSE BBS v0.95.13 (GNU/Linux-x86_64)
    * Origin: http://groups.google.com (110:300/1.1@linuxnet)