mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Parag N(पराग़)" <panemade@gmail.com>
To: chinmaya@innomedia.soft.net
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Gettin own IP address thorugh ioctl in kernel space.
Date: Wed, 19 Jul 2006 15:22:33 +0530	[thread overview]
Message-ID: <f4586a2e0607190252g61e97f35o220dfde4e5401afd@mail.gmail.com> (raw)
In-Reply-To: <44BDFC64.607@innomedia.soft.net>

Hi,
On 7/19/06, Chinmaya Mishra <chinmaya4@gmail.com> wrote:
> Hi,
>
> Can you provide an example how to invoke ioctl on
> device in kernel module.
>
> For example. I want to find out the IP address of
> my eth0 and I want to make SIOCSIFADDR on it from
> kernel module.
>
>
> At user space i am doing it like this.....
>
>  unsigned long *ip;
>  char *iface;
>  int sockfd;
>  struct ifreq ifr;
>  strcpy(ifr.ifr_name, iface);   // interface name 'eth0'
>  sockfd = socket(AF_INET,SOCK_DGRAM,0);
>  ioctl(sockfd, SIOCGIFADDR, (char*)&ifr);
>  memcpy(ip, &(ifr.ifr_addr.sa_data[2]),4); //Copy the ip addr
>  close(sockfd);
>
> How to port this in keernel space.
 Check point 29 from http://kasperd.net/~kasperd/comp.os.linux.development.faq.
Modify that source code according to your needs.
Regards,
Parag.

  reply	other threads:[~2006-07-19  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-19  9:33 Chinmaya Mishra
2006-07-19  9:52 ` Parag N(पराग़) [this message]
2006-07-19 11:56 ` Erik Mouw
2006-07-19 15:07   ` Jan Engelhardt
2006-07-19 15:23     ` Valdis.Kletnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f4586a2e0607190252g61e97f35o220dfde4e5401afd@mail.gmail.com \
    --to=panemade@gmail.com \
    --cc=chinmaya@innomedia.soft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®