[EMAIL PROTECTED] wrote:

  Yes, you may. Just suppround call with:

                  mm_segment_t    oldfs;

                  oldfs = get_fs(); set_fs(KERNEL_DS);
                  err = devinet_ioctl(...);
                  set_fs(oldfs);

  Alexey Kuznetsov


Yes, I figured that one out, thank you.  But I still get the wrong
remote address.
Ifconfig says:
ppp0      Link encap:Point-to-Point Protocol
          inet addr:201.1.1.1  P-t-P:201.1.1.2  Mask:255.255.255.0
          UP POINTOPOINT RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          Interrupt:7 Base address:0x360 Memory:c00ee000-c00effff

When I run the devinet_ioctl call in my module:

...
   memset(&if_info, 0, sizeof(struct ifreq));
   strcpy(if_info.ifr_name, dev->name);

   set_fs(get_ds());

   err = devinet_ioctl( SIOCGIFADDR, &if_info );                   /*
Get local address */
   if_data1 = (struct sockaddr_in *)&if_info.ifr_addr;

   err = devinet_ioctl( SIOCGIFDSTADDR, &if_info );           /* Get
remote address */
   if_data2 = (struct sockaddr_in *)&if_info.ifr_dstaddr;

   set_fs(fs);

   cfg.ip_options  = 0x85;
   cfg.ip_local  = if_data1->sin_addr.s_addr;
   cfg.ip_remote  = if_data2->sin_addr.s_addr;

   When I print the obtained addresses the results are:

   if_data1->sin_addr.s_addr = 201.1.1.1
   if_data2->sin_addr.s_addr = 201.1.1.1

   As you can see the remote address is the same as the local one.
Ifconfig still gives the above result !?!?
   Am I doing something wrong ?

I took a look at ifconfig source,
     it seems that they are using  sock->ops->ioctl calls to obtain
correct local and remote addresses.
     could I use something like this in my driver ??? since
devinte_ioctl call is not working.


Thanks for you help,

Nenad Corbic
Sangoma Technologies


-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to