LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-28-2013, 06:49 AM   #1
pchris
LQ Newbie
 
Registered: Oct 2013
Posts: 1

Rep: Reputation: Disabled
Can a netdev driver configure the ip address of the device?


I am writing a netdev driver for proprietary HW used in industrial automation. The HW has no ethernet interface, so the driver actually communicates via a bus to another proprietary piece of HW (the master) that has an ethernet interface. The design is fixed, so there is nothing I can do about it.

The IP address, that the first machine should use, is configured on the master, and is sent via the bus to the first machine during initialisation.
So the driver on the first machine eventually receives its IP address, but how do I tell the kernel about it? I would not like to use DHCP - there must be a simpler way.

I can configure the MAC address using eth_mac_addr().

There is very little I can do on the master (it is safety related), so it is not an option to let it change the IP address in every packet on the bus. It needs to copy every packet unchanged.

My current solution (DHCP like) is to let the driver create files in /sys/class/net containing the information, and to let some userspace script monitor these files and execute an apropriate ifconfig command. I don't find that elegant.

Is there a way to do this? All the "good" functions seem to be static in net/ipv4/netdev.c, except devinet_ioctl() which requires a userspace buffer.

Kernel 3.9, going for 3.10.

(This was originally posted in a linux.com forum, but there seems to be very little activity there)
 
Old 11-16-2013, 07:47 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
So the driver on the first machine eventually receives its IP address, but how do I tell the kernel about it?
I would imagine that you could pass a command to the kernel but I'm sorry; I do not know what that would be.

I have been coming here to Linux Question for a while now and I have confidence that there are more experienced members that can help you. It's my hope that someone will chime in soon.

These links may help-

http://www.denx.de/wiki/DULG/LinuxKernelArgs
http://stackoverflow.com/questions/1...-kernel-module
http://stackoverflow.com/questions/1...e-at-boot-time
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Added myself to netdev but wicd says I still need to be in netdev enine Slackware 7 09-24-2010 07:36 AM
Get the MAC address in Linux Device Driver saurin Programming 1 12-10-2009 09:05 PM
LXer: Include diff attachment -- Re: Fedora-netdev FC4: kernel-2.6.14-1.1656_FC4.netdev.7 is now available! LXer Syndicated Linux News 0 01-09-2006 08:01 PM
LXer: Fedora-netdev FC4: kernel-2.6.14-1.1653_FC4.netdev.6 is now available! LXer Syndicated Linux News 0 12-15-2005 01:32 PM
LXer: Fedora-netdev FC4: kernel-2.6.14-1.1644_FC4.netdev.5 is now available! LXer Syndicated Linux News 0 12-12-2005 03:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration