Bug 108956 - lokkit does not handle > 10 interfaces
lokkit does not handle > 10 interfaces
Status: CLOSED DUPLICATE of bug 88533
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: gnome-lokkit (Show other bugs)
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2003-11-03 14:18 EST by Rick Beldin
Modified: 2014-03-16 22:40 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-21 13:59:41 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Rick Beldin 2003-11-03 14:18:21 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)

Description of problem:

This defect appears to Redhat specific since it refers to the
/usr/sbin/lokkit command. 

/usr/sbin/lokkit will not correctly interpret the interfaces if there
are more than 10 configured interfaces.  The symptom is that lokkit
will appear to hang. 

No curses displays were displayed at all.   strace logs showed that we
got as far as an open() on /etc/sysconfig/network-scripts and that was it.
When I downloaded source for that revision, I found where I think
the problem is occurring:

char **getNetworkDevices(int *len) {
        int num = 0;
        DIR *dir;
        char **ret = malloc(20*sizeof(char *));
        struct dirent *dent;

        dir = opendir("/etc/sysconfig/network-scripts");
        if (dir) {
                while ((dent = readdir(dir))) {
                        if (!strncmp(dent->d_name,"ifcfg-",6) &&
                            !strstr(dent->d_name,":") &&
                            strcmp(dent->d_name,"ifcfg-lo")) {
                                if (num > 20)

                                  ret = realloc(ret, num+1 *
sizeof(char *));
                                ret[num] = strdup(dent->d_name+6);
        *len = num;
        if (ret) {
                qsort((void *)ret, num, sizeof(char *),
                      (int (*)(const void *, const void *))strcmp);
        return ret;

Reducing the number of interfaces allows the program to run normally. 

I wrote to Alan Cox (maintainer) and his reply was: 

>> 	software.  I recently was working a case with a customer who
>> 	experienced a strange problem with /usr/sbin/lokkit, from the
>> 	lokkit-0.50-6 package.

That should go in Red Hat bugzilla I think

>>                                  if (num > 20)
>>                                    ret = realloc(ret, num+1 *
sizeof(char *));

Thats the bug - it should be (num + 1) * sizeof(char *). The bracket
is rather important. Fixing that ought to fix your customer problem
but please file it and my suggested fix comment in Red Hat bugzilla
(the code in question isnt in the non Red Hat lokkit version)



Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Configure /etc/sysconfig/network-scripts to have > 10 ethernet devices
2. /usr/sbin/lokkit 

Actual Results:  lokkit appears to hang.  We never get to curses screen. 

If you run strace on it, the last system call appears to be an open()
of /etc/sysconfig/network-scripts followed by a getdents() call: 

SYS_1212(0x3, 0x60000fffffffb300, 0x1f8, 0x2000000000304c80,
0, 0x40000000000070f0, 0x10800) = 0

Expected Results:  /usr/sbin/lokkit should have brought up a screen to
allow you to configure your firewall. 

Additional info:
Comment 1 Bill Nottingham 2003-11-03 15:41:35 EST

*** This bug has been marked as a duplicate of 88533 ***
Comment 2 Red Hat Bugzilla 2006-02-21 13:59:41 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

Note You need to log in before you can comment on or make changes to this bug.