Access IP Address in Network Driver?

Hi,
I want to access my IP address that is assigned for my interface (using
ifconfig), in my Network Driver. How can I do that. Which Structure has my
IP address?

Thanks
jalaja

I would worry about putting ip isms in your driver. What if your
driver is running below a different protocol?

Anyway, you should be able to open a socket and do a SIOCGIFCONF
from within your driver. Not that you should…

-seanb

JalajaDevi <jganapat@storage.com> wrote:
: Hi,
: I want to access my IP address that is assigned for my interface (using
: ifconfig), in my Network Driver. How can I do that. Which Structure has my
: IP address?

: Thanks
: jalaja

Hi, I am sorry, I am not very clear here. wat is ip isms? I am running my
driver under TCP/IP protocol.
Opening a socket inside the driver? u mean

open(socket)
ioctl (SIOCGIFCONF).

In Linux, I have a netdevice structure which holds the linked list of IP
addresses that are configured for my interface. So I could get the access to
it when the packet flows down from the TCP/IP socket. In the same way, Is
there any way I can get hold of the IP addresses?
Please explain.

Thanks
Jalaja

“Sean Boudreau” <seanb@qnx.com> wrote in message
news:9q78co$94k$1@nntp.qnx.com

I would worry about putting ip isms in your driver. What if your
driver is running below a different protocol?

Anyway, you should be able to open a socket and do a SIOCGIFCONF
from within your driver. Not that you should…

-seanb

JalajaDevi <> jganapat@storage.com> > wrote:
: Hi,
: I want to access my IP address that is assigned for my interface (using
: ifconfig), in my Network Driver. How can I do that. Which Structure has
my
: IP address?

: Thanks
: jalaja

JalajaDevi <jganapat@storage.com> wrote:
: Hi, I am sorry, I am not very clear here. wat is ip isms? I am running my
: driver under TCP/IP protocol.

How do you know that for sure? Our view of a driver is something
that puts packets on / takes packets from the link layer. Most link
layers aren’t protocol specific.

: Opening a socket inside the driver? u mean

: open(socket)
fd = socket(AF_INET, SOCK_DGRAM, 0);
: ioctl (fd, SIOCGIFCONF).

right.

: In Linux, I have a netdevice structure which holds the linked list of IP
: addresses that are configured for my interface. So I could get the access to
: it when the packet flows down from the TCP/IP socket. In the same way, Is
: there any way I can get hold of the IP addresses?
: Please explain.

: Thanks
: Jalaja

: “Sean Boudreau” <seanb@qnx.com> wrote in message
: news:9q78co$94k$1@nntp.qnx.com
:>
:> I would worry about putting ip isms in your driver. What if your
:> driver is running below a different protocol?
:>
:> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:> from within your driver. Not that you should…
:>
:> -seanb
:>
:> JalajaDevi <jganapat@storage.com> wrote:
:> : Hi,
:> : I want to access my IP address that is assigned for my interface (using
:> : ifconfig), in my Network Driver. How can I do that. Which Structure has
: my
:> : IP address?
:>
:> : Thanks
:> : jalaja
:>
:>
:>

JalajaDevi <jganapat@storage.com> wrote:

Hi, I am sorry, I am not very clear here. wat is ip isms? I am running my
driver under TCP/IP protocol.
Opening a socket inside the driver? u mean

Well, if you are a driver (producer), and have connection with
tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
message in it. You also would get a “ip_addr_down” message if the
assigned IP address deleted.

Check the sys/io-net.h for message detail.

-xtang



open(socket)
ioctl (SIOCGIFCONF).

In Linux, I have a netdevice structure which holds the linked list of IP
addresses that are configured for my interface. So I could get the access to
it when the packet flows down from the TCP/IP socket. In the same way, Is
there any way I can get hold of the IP addresses?
Please explain.

Thanks
Jalaja

“Sean Boudreau” <> seanb@qnx.com> > wrote in message
news:9q78co$94k$> 1@nntp.qnx.com> …

I would worry about putting ip isms in your driver. What if your
driver is running below a different protocol?

Anyway, you should be able to open a socket and do a SIOCGIFCONF
from within your driver. Not that you should…

-seanb

JalajaDevi <> jganapat@storage.com> > wrote:
: Hi,
: I want to access my IP address that is assigned for my interface (using
: ifconfig), in my Network Driver. How can I do that. Which Structure has
my
: IP address?

: Thanks
: jalaja

Xiaodan Tang <xtang@qnx.com> wrote:
: JalajaDevi <jganapat@storage.com> wrote:
:> Hi, I am sorry, I am not very clear here. wat is ip isms? I am running my
:> driver under TCP/IP protocol.
:> Opening a socket inside the driver? u mean

: Well, if you are a driver (producer), and have connection with
: tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
: message in it. You also would get a “ip_addr_down” message if the
: assigned IP address deleted.

: Check the sys/io-net.h for message detail.

: -xtang

The arp layer doesn’t pass these on. Again because they are
ip specific and the arp layer knows that it is ethernet below it
(assuming you are writing an ethernet driver).

-seanb



:> open(socket)
:> ioctl (SIOCGIFCONF).

:> In Linux, I have a netdevice structure which holds the linked list of IP
:> addresses that are configured for my interface. So I could get the access to
:> it when the packet flows down from the TCP/IP socket. In the same way, Is
:> there any way I can get hold of the IP addresses?
:> Please explain.

:> Thanks
:> Jalaja

:> “Sean Boudreau” <seanb@qnx.com> wrote in message
:> news:9q78co$94k$1@nntp.qnx.com
:>>
:>> I would worry about putting ip isms in your driver. What if your
:>> driver is running below a different protocol?
:>>
:>> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:>> from within your driver. Not that you should…
:>>
:>> -seanb
:>>
:>> JalajaDevi <jganapat@storage.com> wrote:
:>> : Hi,
:>> : I want to access my IP address that is assigned for my interface (using
:>> : ifconfig), in my Network Driver. How can I do that. Which Structure has
:> my
:>> : IP address?
:>>
:>> : Thanks
:>> : jalaja
:>>
:>>
:>>

Thanx xtang! Yeah, I could see the my send_fxn gets invoked when i do an
ifconfig with _NPKT_FLAG_MSG. But I have not analysed the packet content
yet. So, therez noway, I could capture my IP address in the driver context?


I think i was clear in mentioning that I am writing an Ethernet Driver.
Anyway, Thanx Seanb.


“Sean Boudreau” <seanb@qnx.com> wrote in message
news:9qenje$pu2$1@nntp.qnx.com

Xiaodan Tang <> xtang@qnx.com> > wrote:
: JalajaDevi <> jganapat@storage.com> > wrote:
:> Hi, I am sorry, I am not very clear here. wat is ip isms? I am running
my
:> driver under TCP/IP protocol.
:> Opening a socket inside the driver? u mean

: Well, if you are a driver (producer), and have connection with
: tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
: message in it. You also would get a “ip_addr_down” message if the
: assigned IP address deleted.

: Check the sys/io-net.h for message detail.

: -xtang

The arp layer doesn’t pass these on. Again because they are
ip specific and the arp layer knows that it is ethernet below it
(assuming you are writing an ethernet driver).

-seanb



:> open(socket)
:> ioctl (SIOCGIFCONF).

:> In Linux, I have a netdevice structure which holds the linked list of
IP
:> addresses that are configured for my interface. So I could get the
access to
:> it when the packet flows down from the TCP/IP socket. In the same way,
Is
:> there any way I can get hold of the IP addresses?
:> Please explain.

:> Thanks
:> Jalaja

:> “Sean Boudreau” <> seanb@qnx.com> > wrote in message
:> news:9q78co$94k$> 1@nntp.qnx.com> …
:
:>> I would worry about putting ip isms in your driver. What if your
:>> driver is running below a different protocol?
:
:>> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:>> from within your driver. Not that you should…
:
:>> -seanb
:
:>> JalajaDevi <> jganapat@storage.com> > wrote:
:>> : Hi,
:>> : I want to access my IP address that is assigned for my interface
(using
:>> : ifconfig), in my Network Driver. How can I do that. Which Structure
has
:> my
:>> : IP address?
:
:>> : Thanks
:>> : jalaja
:
:
:

In article <9qers2$ien$1@inn.qnx.com>, jganapat@storage.com says…

Thanx xtang! Yeah, I could see the my send_fxn gets invoked when i do an
ifconfig with _NPKT_FLAG_MSG. But I have not analysed the packet content
yet. So, therez noway, I could capture my IP address in the driver context?

I can think of at least one possible way. It may have unacceptable
drawbacks, however.
Since you get packets sent to the driver for transmission, you could look
in the packet itself for the source IP address.
The drawbacks come from timing, existence of transmit packets, broadcast
and multicast addresses, and other things like that.

I think i was clear in mentioning that I am writing an Ethernet Driver.
Anyway, Thanx Seanb.


“Sean Boudreau” <> seanb@qnx.com> > wrote in message
news:9qenje$pu2$> 1@nntp.qnx.com> …
Xiaodan Tang <> xtang@qnx.com> > wrote:
: JalajaDevi <> jganapat@storage.com> > wrote:
:> Hi, I am sorry, I am not very clear here. wat is ip isms? I am running
my
:> driver under TCP/IP protocol.
:> Opening a socket inside the driver? u mean

: Well, if you are a driver (producer), and have connection with
: tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
: message in it. You also would get a “ip_addr_down” message if the
: assigned IP address deleted.

: Check the sys/io-net.h for message detail.

: -xtang

The arp layer doesn’t pass these on. Again because they are
ip specific and the arp layer knows that it is ethernet below it
(assuming you are writing an ethernet driver).

-seanb



:> open(socket)
:> ioctl (SIOCGIFCONF).

:> In Linux, I have a netdevice structure which holds the linked list of
IP
:> addresses that are configured for my interface. So I could get the
access to
:> it when the packet flows down from the TCP/IP socket. In the same way,
Is
:> there any way I can get hold of the IP addresses?
:> Please explain.

:> Thanks
:> Jalaja

:> “Sean Boudreau” <> seanb@qnx.com> > wrote in message
:> news:9q78co$94k$> 1@nntp.qnx.com> …
:
:>> I would worry about putting ip isms in your driver. What if your
:>> driver is running below a different protocol?
:
:>> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:>> from within your driver. Not that you should…
:
:>> -seanb
:
:>> JalajaDevi <> jganapat@storage.com> > wrote:
:>> : Hi,
:>> : I want to access my IP address that is assigned for my interface
(using
:>> : ifconfig), in my Network Driver. How can I do that. Which Structure
has
:> my
:>> : IP address?
:
:>> : Thanks
:>> : jalaja
:
:
:



\


Stephen Munnings
Software Developer
Corman Technologies Inc.

That’s probably a MSG packet telling you to join the all
hosts multicast group.

-seanb

JalajaDevi <jganapat@storage.com> wrote:
: Thanx xtang! Yeah, I could see the my send_fxn gets invoked when i do an
: ifconfig with _NPKT_FLAG_MSG. But I have not analysed the packet content
: yet. So, therez noway, I could capture my IP address in the driver context?


: I think i was clear in mentioning that I am writing an Ethernet Driver.
: Anyway, Thanx Seanb.


: “Sean Boudreau” <seanb@qnx.com> wrote in message
: news:9qenje$pu2$1@nntp.qnx.com
:> Xiaodan Tang <xtang@qnx.com> wrote:
:> : JalajaDevi <jganapat@storage.com> wrote:
:> :> Hi, I am sorry, I am not very clear here. wat is ip isms? I am running
: my
:> :> driver under TCP/IP protocol.
:> :> Opening a socket inside the driver? u mean
:>
:> : Well, if you are a driver (producer), and have connection with
:> : tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
:> : message in it. You also would get a “ip_addr_down” message if the
:> : assigned IP address deleted.
:>
:> : Check the sys/io-net.h for message detail.
:>
:> : -xtang
:>
:> The arp layer doesn’t pass these on. Again because they are
:> ip specific and the arp layer knows that it is ethernet below it
:> (assuming you are writing an ethernet driver).
:>
:> -seanb
:>
:>
:>
:> :> open(socket)
:> :> ioctl (SIOCGIFCONF).
:>
:> :> In Linux, I have a netdevice structure which holds the linked list of
: IP
:> :> addresses that are configured for my interface. So I could get the
: access to
:> :> it when the packet flows down from the TCP/IP socket. In the same way,
: Is
:> :> there any way I can get hold of the IP addresses?
:> :> Please explain.
:>
:> :> Thanks
:> :> Jalaja
:>
:> :> “Sean Boudreau” <seanb@qnx.com> wrote in message
:> :> news:9q78co$94k$1@nntp.qnx.com
:> :>>
:> :>> I would worry about putting ip isms in your driver. What if your
:> :>> driver is running below a different protocol?
:> :>>
:> :>> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:> :>> from within your driver. Not that you should…
:> :>>
:> :>> -seanb
:> :>>
:> :>> JalajaDevi <jganapat@storage.com> wrote:
:> :>> : Hi,
:> :>> : I want to access my IP address that is assigned for my interface
: (using
:> :>> : ifconfig), in my Network Driver. How can I do that. Which Structure
: has
:> :> my
:> :>> : IP address?
:> :>>
:> :>> : Thanks
:> :>> : jalaja
:> :>>
:> :>>
:> :>>
:>
:>
:>

Stephen Munnings <steve@cormantech.com> wrote:
: In article <9qers2$ien$1@inn.qnx.com>, jganapat@storage.com says…
:> Thanx xtang! Yeah, I could see the my send_fxn gets invoked when i do an
:> ifconfig with _NPKT_FLAG_MSG. But I have not analysed the packet content
:> yet. So, therez noway, I could capture my IP address in the driver context?
:>

: I can think of at least one possible way. It may have unacceptable
: drawbacks, however.
: Since you get packets sent to the driver for transmission, you could look
: in the packet itself for the source IP address.
: The drawbacks come from timing, existence of transmit packets, broadcast
: and multicast addresses, and other things like that.

Also forwarded packets which will have a different src ip.

-seanb

:>
:> I think i was clear in mentioning that I am writing an Ethernet Driver.
:> Anyway, Thanx Seanb.
:>
:>
:> “Sean Boudreau” <seanb@qnx.com> wrote in message
:> news:9qenje$pu2$1@nntp.qnx.com
:> > Xiaodan Tang <xtang@qnx.com> wrote:
:> > : JalajaDevi <jganapat@storage.com> wrote:
:> > :> Hi, I am sorry, I am not very clear here. wat is ip isms? I am running
:> my
:> > :> driver under TCP/IP protocol.
:> > :> Opening a socket inside the driver? u mean
:> >
:> > : Well, if you are a driver (producer), and have connection with
:> > : tcpip stack, you will receive a _NPKT_FLAG_MSG npkt, with “ip_addr_up”
:> > : message in it. You also would get a “ip_addr_down” message if the
:> > : assigned IP address deleted.
:> >
:> > : Check the sys/io-net.h for message detail.
:> >
:> > : -xtang
:> >
:> > The arp layer doesn’t pass these on. Again because they are
:> > ip specific and the arp layer knows that it is ethernet below it
:> > (assuming you are writing an ethernet driver).
:> >
:> > -seanb
:> >
:> >
:> >
:> > :> open(socket)
:> > :> ioctl (SIOCGIFCONF).
:> >
:> > :> In Linux, I have a netdevice structure which holds the linked list of
:> IP
:> > :> addresses that are configured for my interface. So I could get the
:> access to
:> > :> it when the packet flows down from the TCP/IP socket. In the same way,
:> Is
:> > :> there any way I can get hold of the IP addresses?
:> > :> Please explain.
:> >
:> > :> Thanks
:> > :> Jalaja
:> >
:> > :> “Sean Boudreau” <seanb@qnx.com> wrote in message
:> > :> news:9q78co$94k$1@nntp.qnx.com
:> > :>>
:> > :>> I would worry about putting ip isms in your driver. What if your
:> > :>> driver is running below a different protocol?
:> > :>>
:> > :>> Anyway, you should be able to open a socket and do a SIOCGIFCONF
:> > :>> from within your driver. Not that you should…
:> > :>>
:> > :>> -seanb
:> > :>>
:> > :>> JalajaDevi <jganapat@storage.com> wrote:
:> > :>> : Hi,
:> > :>> : I want to access my IP address that is assigned for my interface
:> (using
:> > :>> : ifconfig), in my Network Driver. How can I do that. Which Structure
:> has
:> > :> my
:> > :>> : IP address?
:> > :>>
:> > :>> : Thanks
:> > :>> : jalaja
:> > :>>
:> > :>>
:> > :>>
:> >
:> >
:> >
:>
:>
:>

: –
: Stephen Munnings
: Software Developer
: Corman Technologies Inc.