Bug 6502 - SIOCSIFHWBROADCAST needs compat layer
Summary: SIOCSIFHWBROADCAST needs compat layer
Status: CLOSED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: x86-64 (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Andi Kleen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-06 08:24 UTC by Alexandra Kossovsky
Modified: 2006-10-22 07:36 UTC (History)
0 users

See Also:
Kernel Version: 2.6.15
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
Fix (661 bytes, patch)
2006-10-22 07:36 UTC, Andi Kleen
Details | Diff

Description Alexandra Kossovsky 2006-05-06 08:24:07 UTC
Most recent kernel where this bug did not occur: all kernels has this problem;
I've tested 2.6.8, 2.6.9, 2.6.15

Distribution:
Hardware Environment: ethernet interface
Software Environment: 32-bit libc with 64-bit kernel
Problem Description:
32-bit program running with 64-bit kernel fails to set hardware broadcast
address via ioctl(SIOCSIFHWBROADCAST).

Steps to reproduce:
Compile the following sample program:
#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if.h>

main()
{
    int             s = socket(AF_INET, SOCK_DGRAM, 0);
    struct ifreq    req;
    int             rc;
    
    if (s < 0)
    {
        perror("failed to open socket");
        return -1;
    }
    strcpy(req.ifr_name, "eth0");
    req.ifr_hwaddr.sa_family = AF_LOCAL;
    memset(req.ifr_hwaddr.sa_data, 0xff, 6);
    rc = ioctl(s, SIOCSIFHWBROADCAST, &req);
    if (rc != 0)
    {
        perror("ioctl failed");
        return -1;
    }
    printf("ioctl(SIOCSIFHWBROADCAST) passed\n");
    return 0;
}

When compiled to 64-bit binary, it works OK:
ioctl(SIOCSIFHWBROADCAST) passed
When compiled to 32-bit binary, it does not work:
ioctl failed: Invalid argument
Comment 1 Andrew Morton 2006-05-06 09:27:46 UTC

Begin forwarded message:

Date: Sat, 6 May 2006 08:24:25 -0700
From: bugme-daemon@bugzilla.kernel.org
To: bugme-new@lists.osdl.org
Subject: [Bugme-new] [Bug 6502] New: SIOCSIFHWBROADCAST needs compat layer


http://bugzilla.kernel.org/show_bug.cgi?id=6502

           Summary: SIOCSIFHWBROADCAST needs compat layer
    Kernel Version: 2.6.15
            Status: NEW
          Severity: normal
             Owner: ak@suse.de
         Submitter: Alexandra.Kossovsky@oktetlabs.ru


Most recent kernel where this bug did not occur: all kernels has this problem;
I've tested 2.6.8, 2.6.9, 2.6.15

Distribution:
Hardware Environment: ethernet interface
Software Environment: 32-bit libc with 64-bit kernel
Problem Description:
32-bit program running with 64-bit kernel fails to set hardware broadcast
address via ioctl(SIOCSIFHWBROADCAST).

Steps to reproduce:
Compile the following sample program:
#include <stdio.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if.h>

main()
{
    int             s = socket(AF_INET, SOCK_DGRAM, 0);
    struct ifreq    req;
    int             rc;
    
    if (s < 0)
    {
        perror("failed to open socket");
        return -1;
    }
    strcpy(req.ifr_name, "eth0");
    req.ifr_hwaddr.sa_family = AF_LOCAL;
    memset(req.ifr_hwaddr.sa_data, 0xff, 6);
    rc = ioctl(s, SIOCSIFHWBROADCAST, &req);
    if (rc != 0)
    {
        perror("ioctl failed");
        return -1;
    }
    printf("ioctl(SIOCSIFHWBROADCAST) passed\n");
    return 0;
}

When compiled to 64-bit binary, it works OK:
ioctl(SIOCSIFHWBROADCAST) passed
When compiled to 32-bit binary, it does not work:
ioctl failed: Invalid argument

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

Comment 2 Andi Kleen 2006-10-22 07:36:11 UTC
Created attachment 9326 [details]
Fix

Sorry for the long delay. I fixed it with this patch now.
It's too late for 2.6.19 though, but should get into 2.6.20
Comment 3 Andi Kleen 2006-10-22 07:36:37 UTC
Fix available and queued for 2.6.20

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