Re: [techtalk] Weird network interface behaviour

2000-10-20 Thread Magni Onsoien

Jeff Dike:
> [EMAIL PROTECTED] said:
> > Then we upgraded the kernel to 2.2.14, and the behaviour changed: now
> > it suddenly started to announce the name/IP on the last virtual
> > interface on eth0 as its name, fex. when being used for irc or when
> > NFS-mounting directories.
> 
> There was a complaint about this on the kernel list a few days ago.  According 
> to Andi Kleen: "tough", although Andi did write a little utility to give your 
> interfaces symbolic names so you can refer to them by those names rather than 
> whatever the kernel decides to call them this week.

Unfortunately this is a different problem from mine. This person problems
with old eth0 becoming eth1 and vice versa, but I have not experiences
this problem (not even when changing from 2.2 -> 2.4). (At least not
that I am aware of, I'll test it a bit.)

Here is an example of my problem: Say that my box impala.domain.no has IP
10.1.2.3. This resolves to the correct hostname and all is good. I
configure eth0 to have this hostname and I want to refer to impala with
this name and adress usually.

Then impala is turned into a web hotel. I then add several virtual
interfaces on eth0 (we can, just for the simplicity, assume that there
is only one NIC).
eth0:1 webmail.domain.no 10.1.2.4
eth0:2 abc.example.com 10.1.2.5
eth0:3 animal.ntnu.no 10.1.2.6

etc.
(I just made up IPs here now, in reality the boxes have other IPs. That
is NOT the problem.)

But I still want to have impala as the main name of the box, and I want
to export my disks etc to impala.domain.no. But the problem with 2.2.x,
x>6 (at least), is that impala will now announce animal.ntnu.no as it's
name in public, so if I ssh out from it to another server it looks like
I come from ntnu.no instead of domain.no (which is bad because I may use
AllowHosts in my sshd_config), and if I try to mount an NFS share it has
to be available to animal.ntnu.no in order to work.

So with this kind of use, this is quite a big problem - I want to be
able to add an "infinite" number of virtual interfaces and I don't want
to have to change my configfiles for ssh, NFS etc all the time. I guess
I can just say that eth0:1000 or something is impala.domain.no, but
honestly, that's no solution even if it works.

I'll do some testing today (if I have time), because I now have a box
with three different NICs (and drivers); the behaviour may vary from
driver to driver. (But I know the problem is there for at least the 
eepro100 and 3c509 drivers.) I think it's a bit strange that so few
people have experienced any problems, so I guess it may be only some
cards with this problem or there is a configuration error in my
kernel...


Magni :)
-- 
sash is very good for you.

___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



[techtalk] (no subject)

2000-10-20 Thread Arindam Chatterjee

hi
when i run the program below:

#include 
#include 
#include 

main()
{
  pid_t pid;
  int x = 5, y = 9;
  pid = fork();
  if(pid == 0)
  {
printf("child process\n addr of x = %x addr of y =
  %x\n", &x, &y);
fflush(stdout);
  }
  else
  {
wait(0);
printf("parent process\n addr of x = %x addr of y
=  %x\n", &x, &y);
fflush(stdout);
  }
  exit(0);
}

i get the following output:

child process
 addr of x = bb00 addr of y = bafc
parent process
 addr of x = bb00 addr of y = bafc
  
so far i know parent and child process should have
separate address space. but here the addresses are
same in both the processes. r they sharing the same
address space? then any change in parent will be
reflected in child. so why do i need pipe or fifo for
IPC? 
can anybody explain this?

arindam 


__
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



[techtalk] can't get my gcc working as cc

2000-10-20 Thread alissa bader

Hey there all, yet another really solaris question,
but I think it's general enough to apply to this list
:>

I have installed gcc and it seems to work all right. 
but when i try to compile some software that asks for
cc, the compile fails.  I've tried setting up a
symbolic link for /usr/ucb/cc to gcc, that doesn't
work at all.  Any other suggestions?  thanks!

--alissa

__
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



Re: [techtalk] can't get my gcc working as cc

2000-10-20 Thread Elaine Poulsen

Check the Makefile for something like:
CC=cc
change cc to gcc.
That may work.

alissa bader wrote:

> Hey there all, yet another really solaris question,
> but I think it's general enough to apply to this list
> :>
>
> I have installed gcc and it seems to work all right.
> but when i try to compile some software that asks for
> cc, the compile fails.  I've tried setting up a
> symbolic link for /usr/ucb/cc to gcc, that doesn't
> work at all.  Any other suggestions?  thanks!
>
> --alissa
>
> __
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/
>
> ___
> techtalk mailing list
> [EMAIL PROTECTED]
> http://www.linux.org.uk/mailman/listinfo/techtalk


___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



Re: [techtalk] Weird network interface behaviour

2000-10-20 Thread Jeff Dike

[EMAIL PROTECTED] said:
> Unfortunately this is a different problem from mine.

Sorry about that.  I think I understand the problem now.

I can't reproduce this on either 2.2.5 or 2.2.14 in the simplest case (add a 
virtual interface, ssh out to another machine, look at where it thinks I came 
from).  The other machine thinks I came from the IP address for eth0, not 
eth0:0.  So, it might be a fixed bug, which also might be why not many people 
are complaining about it.

> But I still want to have impala as the main name of the box, and I
> want to export my disks etc to impala.domain.no. But the problem with
> 2.2.x, x>6 (at least), is that impala will now announce animal.ntnu.no
> as it's name in public, so if I ssh out from it to another server it
> looks like I come from ntnu.no instead of domain.no (which is bad
> because I may use AllowHosts in my sshd_config), and if I try to mount
> an NFS share it has to be available to animal.ntnu.no in order to
> work.

Does your routing table have entries for eth0:1, eth0:2, etc?  If so, that 
might be how the machine is deciding which IP address to say that you're 
coming from.  Deleting those routes and making sure that there is only the 
route for eth0 might fix it.

Another possibility would be to have your nameserver use impala.domain.no as 
the primary name for each of the new IP addresses, so in your example, the 
name server entries would look like:

10.1.2.4 impala.domain.no webmail.domain.no #eth0:1 
10.1.2.5 impala.domain.no abc.example.com   #eth0:2
10.1.2.6 impala.domain.no animal.ntnu.no#eth0:3

I'm not sure if that will work, because it depends on whether the other 
machine does a reverse lookup on your IP and compares it with the name in 
whatever config file is relevant (which will work because it will get back 
impala.domain.no for any of the addresses on that machine) or whether it does 
a lookup on the names in the config files and compares that with your IP 
(which won't because it will get back 10.1.2.3 for impala.domain.no and you'll 
be coming from 10.1.2.6).

I think the first case is more likely, but I don't know for sure.

Jeff




___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



Re: [techtalk] (no subject)

2000-10-20 Thread Laurel Fan

Excerpts from linuxchix: 20-Oct-100 [techtalk] (no subject) by Arindam
Chatterjee@yahoo 
> i get the following output:
>  
> child process
>  addr of x = bb00 addr of y = bafc
> parent process
>  addr of x = bb00 addr of y = bafc
>   
> so far i know parent and child process should have
> separate address space. but here the addresses are
> same in both the processes. r they sharing the same
> address space? then any change in parent will be
> reflected in child. so why do i need pipe or fifo for
> IPC? 
> can anybody explain this?

You are correct, the processes have a separate address space.
Variables in both have the same addresses because these are
virtual addresses, not the actual physical address.

Most modern OSes don't allow user level processes to access arbitrary
physical addresses.  When you access a memory address, what really
happens is that it gets the virtual page number of the address (a page
is basically a fixed size chunk of memory, usually about 4k-ish.
pages are used because you don't want to have to translate every
virtual address to a physical address; with pages you can do a chunk
at a time), looks it up the the process's page table (a table that
maps virtual pages to physical pages), and then goes to the physical
page.

This gets you a lot of good things:

1. Memory protection.  If you don't have a page table entry for
a piece of memory, you can't access it.

2. Demand paging/swapping.  The page table can also point to disk, so
you can use more 'memory' than you have memory (so you can run
netscape :)).

3. Non-continuous physical addresses.  Your program can be in pieces
spread all over physical memory, and it'll still look like you have
a continuous address space.

(One thing to notice is that those addresses probably point to more
memory than you have. bb0 is somewhere in the 3G range.)

You can test this by actually assigning to the variable and seeing
if it affects the other process, by using code like [1].

Running that, I get:

child process
 addr of x = bbd4 addr of y = bbd0, x=10, y=15
parent process
 addr of x = bbd4 addr of y = bbd0, x=5, y=9

They have the same virtual address, but the values of the variable,
and therefore the memory that the address actually points to, are
different.

If you actually want the 'processes' to be able to mess with each
others' variables, you probably want to use threads.  [2] is similar
to your code, except it uses threads.  When running that, I get:

parent process (pid 5124) before pthread_create
 addr of x = 8049828 addr of y = 804982c, x=5, y=9
child thread (pid 5126)
 addr of x = 8049828 addr of y = 804982c, x=15, y=10
parent process (pid 5124) after pthread_create
 addr of x = 8049828 addr of y = 804982c, x=15, y=10

What the child thread did affected the variables in the parent process.

However, you don't get this for free.  There are a lot of new things
you have to worry about when you share variables between threads.
For example, suppose you have this code:

x = 2;
y = x;
x++;

You'd always expect this to end up with x=3, y=2, right? Not if you have
multiple threads.  It could do this:

A doesx = 2;   
B x = 2;
B y = x;   // x=2, y=2
A y = x;   // x=2, y=2
B x++; // x=3, y=2
A x++; // x=4, y=2

Or it could do this:

A doesx = 2;   
B x = 2;
B y = x;   // x=2, y=2
B x++; // x=3, y=2
A y = x;   // x=3, y=3
A x++; // x=4, y=3

To prevent the above from happening, you have to use mutex locks
(MUTual EXclusion locks prevent two processes from running the same
code at the same time).  If you do use threads, you should probably
get a good book on thread programming.

[1] looking at values of variables changed after a fork
-
#include 
#include 
#include 

main()
{
  pid_t pid;
  int x = 5, y = 9;
  pid = fork();
  if(pid == 0)
  {
x = 10, y = 15;
printf("child process\n addr of x = %x addr of y = %x, x=%d, y=%d\n",
   &x, &y, x, y);
fflush(stdout);
  }
  else
  {
wait(0);
printf("parent process\n addr of x = %x addr of y = %x, x=%d, y=%d\n",
   &x, &y, x, y);
fflush(stdout);
  }
  exit(0);
}
-

[2] looking at values of variables changed after a pthread_create (must
be compiled with -lpthread)

#include 
#include 
#include 
#include 

int x = 5;
int y = 9;

int change_variables(void *v)
{
  x = 15;
  y = 10;
  printf("child thread (pid %d)\n addr of x = %x addr of y = %x, x=%d, y=%d\n",
 getpid(), &x, &y, x, y);
  pthread_exit(NULL);
}

main()
{
  int pid;
  pthread_t thr;


  printf("parent process (pid %d) before pthread_create\n addr of x = %x
addr of
 y = %x, x=%d, y=%d\n",
 getpid(), &x, &y, x, y);

  /* this will create a new thread that starts by calling the function
 change_variables */
  pthread_create(&thr, NULL, &change_variables, NULL);

  /* this is like wait, it waits for the thread created above to fini

Re: [techtalk] (no subject)

2000-10-20 Thread Jeff Dike

[EMAIL PROTECTED] said:
> so far i know parent and child process should have separate address
> space. but here the addresses are same in both the processes. r they
> sharing the same address space?

They are in different address spaces, which is why those addresses can be the 
same without them interfering with each other.

If you look at the memory usage of other unrelated processes (look in 
/proc/[pid]/maps), you'll see that they all have their binaries loaded a bit 
higher than 0x800, they all have shared libraries starting at 0x4000, 
and they all have stacks ending at 0xc000.

The reason that they're not all tromping on each other is that those are 
virtual addresses which are mapped to different physical addresses by the OS 
and processor.

Jeff



___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk



Re: [techtalk] can't get my gcc working as cc

2000-10-20 Thread stephanie1200

Try putting gcc before cc in the path of the user that's doing the compiling 
(presumably root).  That has worked for me.  Also, I've hit lots of 
situations where a compile finally uses gcc and keeps complaining.  Adding 
/usr/ccs2/bin and /usr/ucb clears up a lot of issues.

What are you compiling?  We've been doing massive amounts of compiling over 
here. Maybe I've seen your problem before.


alissa bader <[EMAIL PROTECTED]> wrote:
>
> Hey there all, yet another really solaris question,
> but I think it's general enough to apply to this list
> :>
> 
> I have installed gcc and it seems to work all right. 
> but when i try to compile some software that asks for
> cc, the compile fails.  I've tried setting up a
> symbolic link for /usr/ucb/cc to gcc, that doesn't
> work at all.  Any other suggestions?  thanks!
> 
> --alissa
> 
> __
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/
> 
> ___
> techtalk mailing list
> [EMAIL PROTECTED]
> http://www.linux.org.uk/mailman/listinfo/techtalk
> 

___
techtalk mailing list
[EMAIL PROTECTED]
http://www.linux.org.uk/mailman/listinfo/techtalk