From: J.H.Kim on
Hi, everyone

I'm using linux in embedded system.
I set the ip address using Kernel's ip auto configuration via u-boot
boot parameter.
But I have to change the ip address in user application program.
How can an user application change the ip address and mac address?
Please tell the hint.

Thanks in advance.
Best Regards,
J.Hwan Kim
From: Philipp Pagel on
J.H.Kim <frog1120(a)gmail.com> wrote:
> Hi, everyone

> I'm using linux in embedded system.
> I set the ip address using Kernel's ip auto configuration via u-boot
> boot parameter.
> But I have to change the ip address in user application program.
> How can an user application change the ip address and mac address?

I have no clue about embedded LINUX but on a regular Linux system ifconfig
would do the job.

cu
Philipp

--
Dr. Philipp Pagel
Lehrstuhl f. Genomorientierte Bioinformatik
Technische Universit�t M�nchen
http://webclu.bio.wzw.tum.de/~pagel/
From: Maxwell Lol on
"J.H.Kim" <frog1120(a)gmail.com> writes:

> Hi, everyone
>
> I'm using linux in embedded system.
> I set the ip address using Kernel's ip auto configuration via u-boot
> boot parameter.
> But I have to change the ip address in user application program.
> How can an user application change the ip address and mac address?
> Please tell the hint.

you can always execute a shell command from C.

From: The Natural Philosopher on
Maxwell Lol wrote:
> "J.H.Kim" <frog1120(a)gmail.com> writes:
>
>> Hi, everyone
>>
>> I'm using linux in embedded system.
>> I set the ip address using Kernel's ip auto configuration via u-boot
>> boot parameter.
>> But I have to change the ip address in user application program.
>> How can an user application change the ip address and mac address?
>> Please tell the hint.
>
> you can always execute a shell command from C.
>

well that wont work without some kind of root permissions.

http://en.wikipedia.org/wiki/Setuid

basically. make ipconfig effectively root.
From: Grant Edwards on
On 2010-02-19, J.H.Kim <frog1120(a)gmail.com> wrote:
> Hi, everyone
>

> But I have to change the ip address in user application program.

Use ioctl() with SIOCSIFADDR.

If you need more details, I suggest you look at the source for
ifconfig.

> How can an user application change the ip address and mac address?

You use SIOCGIFHWADDR to read the MAC addres, but IIRC, setting
the MAC address is board-specific.

--
Grant