ax25_gifconf ?

From: Tomi Manninen OH2BNS (terhi.victor@logonet.com)
Date: Thu Jun 01 2000 - 12:36:23 EEST

  • Next message: Tomi Manninen OH2BNS: "Re: SCC causes kernel crash (fwd)"

    Hi all,

    I was digging through the newax25 implementation the other day and it
    seemed to me, we could benefit from backporting the ax25_gifconf() stuff
    to mainstream kernels. That would lift the ugly "device needs to have an
    IP address to enable AX.25 connections" requirement.

    However I'm not 100% sure what that function should do and if what Jens
    has done is really correct. Should we restrict to returning info only for
    known AX.25 interfaces? (inet_gifconf() seems to do so.) Even then an
    AX.25 interface with an IP address would be listed twice in dev_ifconf()
    output. And what should be filled in in the ifreq struct? Is there a
    standard to follow? Currently IPv4 seems to be the only one to register a
    xxx_gifconf function. Should we?

    The following is what I have tested. It is mostly copied from Jens' work,
    with cosmetic changes and the ax25_dev_ax25dev() check is my
    contribution... Seems to work and I haven't seen any ill effects so
    far. Comments?

    static int ax25_gifconf(struct device *dev, char *buf, int len)
    {
            struct ifreq ifr;

            if (!ax25_dev_ax25dev(dev))
                    return 0;

            if (!buf)
                    return sizeof(struct ifreq);

            if (len < (int) sizeof(struct ifreq))
                    return 0;

            memset(&ifr, 0, sizeof(struct ifreq));

            strcpy(ifr.ifr_name, dev->name);
            (*(struct sockaddr_in *) &ifr.ifr_addr).sin_family = AF_AX25;

            if (copy_to_user(buf, &ifr, sizeof(struct ifreq)))
                    return -EFAULT;

            return sizeof(struct ifreq);
    }

    -- 
    Tomi Manninen           Internet:  hcanptu.kochta@b3g-telecom.com
    OH2BNS                  AX.25:     jsmxgtby.ywrz@hgfip.com
    KP20ME04                Amprnet:   terhi.victor@logonet.com
    



    This archive was generated by hypermail 2b29 : Thu Jun 01 2000 - 12:36:51 EEST