Hi Folks,

i hope you could help me.

Problem Description:
I have a device that i want to connect with my HomePC using an USB RNDIS
Connection. Setting up the inf File is not that Problem, the Inf File works
and Windows sets up an Network Device that i can use for this Connection.
After configuring the netzworkdevice (IP-Adress, etc.) everything works fine.
But:
Can i configure the Networkdevice automatically after Installation? That
means that after the correct driver is installed, the networkdevice should
have an IP-Adress.

Can i configure the IP of the connected Device remotely? (For testing
purpose i have set the Ip-Adress of the device manually..)


Thanks for advice
Stefan

RE: USB RNDIS by StefanBusch

StefanBusch
Mon Oct 15 01:20:01 PDT 2007

oh.. i have forgotten to tell you that this should work with windows xp/2000
and vista(if possible)

"Stefan Busch" wrote:

> Hi Folks,
>
> i hope you could help me.
>
> Problem Description:
> I have a device that i want to connect with my HomePC using an USB RNDIS
> Connection. Setting up the inf File is not that Problem, the Inf File works
> and Windows sets up an Network Device that i can use for this Connection.
> After configuring the netzworkdevice (IP-Adress, etc.) everything works fine.
> But:
> Can i configure the Networkdevice automatically after Installation? That
> means that after the correct driver is installed, the networkdevice should
> have an IP-Adress.
>
> Can i configure the IP of the connected Device remotely? (For testing
> purpose i have set the Ip-Adress of the device manually..)
>
>
> Thanks for advice
> Stefan

Re: USB RNDIS by chris

chris
Mon Oct 15 12:10:39 PDT 2007

On Oct 15, 2:56 am, Stefan Busch <Stefan
Bu...@discussions.microsoft.com> wrote:

> Can i configure the Networkdevice automatically after Installation? That
> means that after the correct driver is installed, the networkdevice should
> have an IP-Adress.

I have to assume there's some convention in RNDIS for accomplishing
this. In the CDC Ethernet world, I embedded a small DHCP server into
my NDIS driver, and then communicated the TCP/IP settings (IP,
netmask, gateway, DNS) to my device via endpoint zero control requests.


Re: USB RNDIS by StefanBusch

StefanBusch
Tue Oct 16 00:32:01 PDT 2007

But how can i serve an IP to my Networkcard? (not to the device plugged to my
pc via usb, but to my simulated networkcard?)

"chris.aseltine@gmail.com" wrote:

> On Oct 15, 2:56 am, Stefan Busch <Stefan
> Bu...@discussions.microsoft.com> wrote:
>
> > Can i configure the Networkdevice automatically after Installation? That
> > means that after the correct driver is installed, the networkdevice should
> > have an IP-Adress.
>
> I have to assume there's some convention in RNDIS for accomplishing
> this. In the CDC Ethernet world, I embedded a small DHCP server into
> my NDIS driver, and then communicated the TCP/IP settings (IP,
> netmask, gateway, DNS) to my device via endpoint zero control requests.
>
>

Re: USB RNDIS by chris

chris
Tue Oct 16 08:27:46 PDT 2007

On Oct 16, 2:32 am, Stefan Busch
<StefanBu...@discussions.microsoft.com> wrote:

> But how can i serve an IP to my Networkcard? (not to the device plugged to my
> pc via usb, but to my simulated networkcard?)

Like I said, I did this in my NDIS miniport using a miniature DHCP
server inside the driver which responded to DHCP discover and request
packets...

If you are using the generic RNDIS driver then I have no idea, but
like I said, there's gotta be a way...


Re: USB RNDIS by Maxim

Maxim
Tue Oct 16 10:58:08 PDT 2007

> But how can i serve an IP to my Networkcard? (not to the device plugged to my
> pc via usb, but to my simulated networkcard?)

Either you rely on a user which will set it in the Control Panel.

Or you write the user-mode code which will do the same by calling IP Helper API
or INetCfg.

Or you implement the fake DHCP server in your driver.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: USB RNDIS by StefanBusch

StefanBusch
Wed Oct 17 02:49:04 PDT 2007

dear chris,

how did you manage to respond to the dchp discover/request messages the
"Client" has sent?

i can only recieve them when i have a ip-address assigned :-(

1. The New NIC Adapter is installed
2. The New Adapter tries to get an DHCP IP Address by sending DCHP Discover
Messages to ipv4 broadcast 255.255.255.255
3. I try to fetch the DHCPDiscover Messages by listening to the UDP Port 67,
but i cant fetch them because i havent an IP-Address yet..
4. The NIC (from 1) gets an APIPA Address assigned
5. The NIC retries to get an DHCP IP -Adress (like 2)
6. I can fetch the DHCPDiscover Message because now my interface has an
APIPA IP
7. The Interface gets the New IP I have configured through my "DHCP"

but how can i directly assign an address without using the APIPA Address?


Thanks a lot!


"chris.aseltine@gmail.com" wrote:

> On Oct 16, 2:32 am, Stefan Busch
> <StefanBu...@discussions.microsoft.com> wrote:
>
> > But how can i serve an IP to my Networkcard? (not to the device plugged to my
> > pc via usb, but to my simulated networkcard?)
>
> Like I said, I did this in my NDIS miniport using a miniature DHCP
> server inside the driver which responded to DHCP discover and request
> packets...
>
> If you are using the generic RNDIS driver then I have no idea, but
> like I said, there's gotta be a way...
>
>

Re: USB RNDIS by chris

chris
Wed Oct 17 08:50:34 PDT 2007

On Oct 17, 4:49 am, Stefan Busch
<StefanBu...@discussions.microsoft.com> wrote:

> how did you manage to respond to the dchp discover/request messages the
> "Client" has sent?
>
> 1. The New NIC Adapter is installed
> 2. The New Adapter tries to get an DHCP IP Address by sending DCHP Discover
> Messages to ipv4 broadcast 255.255.255.255
> 3. I try to fetch the DHCPDiscover Messages by listening to the UDP Port 67,
> but i cant fetch them because i havent an IP-Address yet..

I think you're saying you have some user mode DHCP server, if you are
using terminology like "listening on UDP Port 67".

My approach is totally different -- I'm inside the network driver
itself, so I can see and identify the very first DHCP discover packet
-- instead of sending it to my device, I complete the discover packet,
construct a new OFFER (and then ACK) packet, and send it back to NDIS
on the fly.


Re: USB RNDIS by StefanBusch

StefanBusch
Thu Oct 18 02:48:00 PDT 2007

yes youre right chris, i have programmed a small dhcp server, and tried to
fake DHCP Offer/Ack packages...

But this won't help me :-) i can only send dhcp offer/ack packages when the
Network adapter has already an ip ..

so.. i´ve never written an driver on my own, is ist possible to modify the
USB RNDIS driver with the DriverDevelopmentKit in that way you did, or do i
have to write the whole rndis driver on my own ?

thanks a lot for your advice chris!

"chris.aseltine@gmail.com" wrote:

> On Oct 17, 4:49 am, Stefan Busch
> <StefanBu...@discussions.microsoft.com> wrote:
>
> > how did you manage to respond to the dchp discover/request messages the
> > "Client" has sent?
> >
> > 1. The New NIC Adapter is installed
> > 2. The New Adapter tries to get an DHCP IP Address by sending DCHP Discover
> > Messages to ipv4 broadcast 255.255.255.255
> > 3. I try to fetch the DHCPDiscover Messages by listening to the UDP Port 67,
> > but i cant fetch them because i havent an IP-Address yet..
>
> I think you're saying you have some user mode DHCP server, if you are
> using terminology like "listening on UDP Port 67".
>
> My approach is totally different -- I'm inside the network driver
> itself, so I can see and identify the very first DHCP discover packet
> -- instead of sending it to my device, I complete the discover packet,
> construct a new OFFER (and then ACK) packet, and send it back to NDIS
> on the fly.
>
>

Re: USB RNDIS by chris

chris
Thu Oct 18 11:21:40 PDT 2007

On Oct 18, 4:48 am, Stefan Busch
<StefanBu...@discussions.microsoft.com> wrote:

> so.. i=B4ve never written an driver on my own, is ist possible to modify =
the
> USB RNDIS driver with the DriverDevelopmentKit in that way you did, or do=
i
> have to write the whole rndis driver on my own ?

I tend to doubt that the MS RNDIS driver can be modified in such a
fashion. However, I have to assume there is some facility to
accomplish what you're trying to do (aside from writing DHCP servers
and so on), so you might want to keep looking.

If you do decide to make your own driver, follow the KMDF NDISEDGE
sample in the WDK. There are even some hints in the readme about how
to change the sample for a USB device. Overall it is not too
complicated, really.

-Chris