Bug 108956 - lokkit does not handle > 10 interfaces
Summary: lokkit does not handle > 10 interfaces
Status: CLOSED DUPLICATE of bug 88533
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: gnome-lokkit   
(Show other bugs)
Version: 2.1
Hardware: ia64
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2003-11-03 19:18 UTC by Rick Beldin
Modified: 2014-03-17 02:40 UTC (History)
1 user (show)

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

Attachments (Terms of Use)

Description Rick Beldin 2003-11-03 19:18:21 UTC
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 20:41:35 UTC

*** This bug has been marked as a duplicate of 88533 ***

Comment 2 Red Hat Bugzilla 2006-02-21 18:59:41 UTC
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.