Networking Forums

Networking Forums > Computer Networking > Linux Networking > SIOCSIFMTU: Bad address

Reply
Thread Tools Display Modes

SIOCSIFMTU: Bad address

 
 
Amit Shar
Guest
Posts: n/a

 
      10-01-2003, 01:48 PM
Hi all,

I try to change an ethernet NIC's mtu using the following code and get
a "Bad address" error. I will appreciate any help with this matter.

I am using Linux kernel 2.4.18-3smp, redhat 7.3

int SetInterfaceMtu(const char *name, int mtu){
struct ifreq ifr;

int sock = socket(PF_INET, SOCK_DGRAM, 0);
if (sock == -1) {
perror("socket");
return 0;
}

strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)-1);
ifr.ifr_mtu = mtu;
if (ioctl(sock, SIOCSIFMTU, ifr) == 0){ //success
close(sock);
return 1;
}
else { //failure
close(sock);
perror("SIOCSIFMTU");
return 0;
}
}

Thank you.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: SIOCSIFMTU error when trying out jumbo frames Jerry Peters Linux Networking 2 10-04-2009 04:26 AM
Pipex Address: Post Office wont sent registered letter as they say the address is invalid! W Broadband 16 05-13-2008 09:30 PM
Coffee shop wifi will not give me IP address, but gives everyone else IP address. But static IP works! Jennifer R Wireless Internet 5 09-30-2007 06:12 AM
"access violation at address 004075e5 module WUSB54G4.exe of address 00000368 Houndog Windows Networking 0 02-12-2006 09:40 PM
When Linux PC boots, Does it sends RARP packet to get its IP address by embedding its Hardware address? santa19992000@yahoo.com Linux Networking 2 10-16-2005 10:40 PM



1 2 3 4 5 6 7 8 9 10 11