~ubuntu-branches/ubuntu/feisty/openafs/feisty

« back to all changes in this revision

Viewing changes to src/rx/rx_kcommon.c

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2007-03-26 18:56:55 UTC
  • Revision ID: package-import@ubuntu.com-20070326185655-osce8n0y0dptgurh
* New upstream release.  (Closes: #415699)
  - Support newer Linux kernels.  (Closes: #409797, #410120)
  - Add aklog fallbacks for null realms to support the referral
    capability in MIT Kerberos 1.6 and later.  (Closes: #410314)
* Apply patch from Thomas Sesselmann to support setting options to pass
  to bosserver in /etc/default/openafs-fileserver.  (Closes: #409357)
* Remove the rx_Init calls in the PAM module.  The internal counters
  that had to be initialized that way have been removed.
* Now that we're running regen.sh as part of the build process, only
  patch the Autoconf source files and not the generated output to make
  the diff easier to audit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include "afs/param.h"
16
16
 
17
17
RCSID
18
 
    ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.13 2006/08/31 04:54:55 shadow Exp $");
 
18
    ("$Header: /cvs/openafs/src/rx/rx_kcommon.c,v 1.44.2.15 2007/02/09 00:20:28 shadow Exp $");
19
19
 
20
20
#include "rx/rx_kcommon.h"
21
21
 
524
524
int
525
525
rxi_GetcbiInfo(void)
526
526
{
527
 
    int i, j, different = 0;
 
527
    int i, j, different = 0, num = ADDRSPERSITE;
528
528
    int rxmtu, maxmtu;
529
529
    afs_uint32 ifinaddr;
530
530
    afs_uint32 addrs[ADDRSPERSITE];
533
533
    memset((void *)addrs, 0, sizeof(addrs));
534
534
    memset((void *)mtus, 0, sizeof(mtus));
535
535
 
536
 
    for (i = 0; i < afs_cb_interface.numberOfInterfaces; i++) {
 
536
    if (afs_cb_interface.numberOfInterfaces < num)
 
537
        num = afs_cb_interface.numberOfInterfaces;
 
538
    for (i = 0; i < num; i++) {
537
539
        if (!afs_cb_interface.mtu[i])
538
540
            afs_cb_interface.mtu[i] = htonl(1500);
539
541
        rxmtu = (ntohl(afs_cb_interface.mtu[i]) - RX_IPUDP_SIZE);
639
641
    afs_uint32 ifinaddr;
640
642
#if defined(AFS_DARWIN80_ENV)
641
643
    errno_t t;
642
 
    int cnt=0;
643
 
    ifaddr_t *ifads, ifad;
644
 
    register ifnet_t ifn;
 
644
    unsigned int count;
 
645
    int cnt=0, m, j;
 
646
    ifaddr_t *ifads;
 
647
    ifnet_t *ifn;
645
648
    struct sockaddr sout;
646
649
    struct sockaddr_in *sin;
 
650
    struct in_addr pin;
647
651
#else
648
652
    struct ifaddr *ifad;        /* ifnet points to a if_addrlist of ifaddrs */
649
653
    register struct ifnet *ifn;
653
657
    memset(mtus, 0, sizeof(mtus));
654
658
 
655
659
#if defined(AFS_DARWIN80_ENV)
656
 
    t = ifnet_get_address_list_family(NULL, &ifads, AF_INET);
657
 
    if (t == 0) {
658
 
        rxmtu = ifnet_mtu(ifn) - RX_IPUDP_SIZE;
659
 
        while((ifads[cnt] != NULL) && cnt < ADDRSPERSITE) {
660
 
            t = ifaddr_address(ifads[cnt], &sout, sizeof(sout));
661
 
            sin = (struct sockaddr_in *)&sout;
662
 
            ifinaddr = ntohl(sin->sin_addr.s_addr);
663
 
            if (myNetAddrs[i] != ifinaddr) {
664
 
                different++;
665
 
            }
666
 
            mtus[i] = rxmtu;
667
 
            rxmtu = rxi_AdjustIfMTU(rxmtu);
668
 
            maxmtu =
669
 
                rxmtu * rxi_nRecvFrags +
670
 
                ((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
671
 
            maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
672
 
            addrs[i++] = ifinaddr;
673
 
            if ((ifinaddr != 0x7f000001) && (maxmtu > rx_maxReceiveSize)) {
674
 
                rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxmtu);
675
 
                rx_maxReceiveSize =
676
 
                    MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
677
 
            }
678
 
            cnt++;
 
660
    if (!ifnet_list_get(AF_INET, &ifn, &count)) {
 
661
        for (m = 0; m < count; m++) {
 
662
            if (!ifnet_get_address_list(ifn[m], &ifads)) {
 
663
                for (j = 0; ifads[j] != NULL && cnt < ADDRSPERSITE; j++) {
 
664
                    if ((t = ifaddr_address(ifads[j], &sout, sizeof(struct sockaddr))) == 0) {
 
665
                        sin = (struct sockaddr_in *)&sout;
 
666
                        rxmtu = ifnet_mtu(ifaddr_ifnet(ifads[j])) - RX_IPUDP_SIZE;
 
667
                        ifinaddr = ntohl(sin->sin_addr.s_addr);
 
668
                        if (myNetAddrs[i] != ifinaddr) {
 
669
                            different++;
 
670
                        }
 
671
                        mtus[i] = rxmtu;
 
672
                        rxmtu = rxi_AdjustIfMTU(rxmtu);
 
673
                        maxmtu =
 
674
                            rxmtu * rxi_nRecvFrags +
 
675
                            ((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
 
676
                        maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
 
677
                        addrs[i++] = ifinaddr;
 
678
                        if ((ifinaddr != 0x7f000001) && 
 
679
                            (maxmtu > rx_maxReceiveSize)) {
 
680
                            rx_maxReceiveSize = 
 
681
                                MIN(RX_MAX_PACKET_SIZE, maxmtu);
 
682
                            rx_maxReceiveSize =
 
683
                                MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
 
684
                        }
 
685
                        cnt++;
 
686
                    }
 
687
                }
 
688
                ifnet_free_address_list(ifads);
 
689
            }
679
690
        }
680
 
        ifnet_free_address_list(ifads);
 
691
        ifnet_list_free(ifn);
681
692
    }
682
693
#else
683
694
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
733
744
    rx_maxJumboRecvSize = MAX(rx_maxJumboRecvSize, rx_maxReceiveSize);
734
745
 
735
746
    if (different) {
736
 
        int j;
737
 
        for (j = 0; j < i; j++) {
738
 
            myNetMTUs[j] = mtus[j];
739
 
            myNetAddrs[j] = addrs[j];
 
747
        int l;
 
748
        for (l = 0; l < i; l++) {
 
749
            myNetMTUs[l] = mtus[l];
 
750
            myNetAddrs[l] = addrs[l];
740
751
        }
741
752
    }
742
753
    return different;