Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi! My eth1 has aliases: eth1:0, eth1:1. Can i define in hard_start_xmit before harware transmitting, that the packet is from eth1:0 or from eth1:1? Thank you....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2007
    Posts
    20

    network driver: define alias in hard_start_xmit


    Hi!

    My eth1 has aliases: eth1:0, eth1:1.
    Can i define in hard_start_xmit before harware transmitting, that the packet is from eth1:0 or from eth1:1?

    Thank you.

  2. #2
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    Why can't you use this?

    Code:
    if ( __dev_get_by_name("eth1:0"))
        strange things go here
    Bus Error: Passengers dumped. Hech gap yo'q.

  3. #3
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    There is no such device "eth1:0", so dev_get_by_name will return NULL.

  4. #4
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    I don't know if there is an "eth1". I guess it would work with this, but that's presumably not what you wanted.

    I don't understand what aliasing you're doing there, but you could try to get hold of a similar string or build one or there is might be a function similar to __dev_get_by_name() that doesn't work with strings but something else instead.
    Bus Error: Passengers dumped. Hech gap yo'q.

  5. #5
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    Dilbert, thak for your answers.

    My task is to define before hardware transmittion (func. hard_start_xmit in network driver) the alias of eth1 to this packet.
    My eth1 has eth1:0 and eth1:1 aliases.
    If packet from eth1:0, i need to change MAC addr int packet to XX:XX:XX:XX:XX:00, eth1:1 - :01.

    But, most likely, there is no method to define alias in driver transmit level

  6. #6
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    I still don't understand what kind of aliasing you're referring to.

    For example, I also don't understand this sentence:

    "My task is to define before hardware transmittion (func. hard_start_xmit in network driver) the alias of eth1 to this packet."

    Anyway, if a packet is supposed to be sent through an Ethernet device, you can query the name of this device. The names are listed when doing an "ifconfig -a".

    You can use printk to get debug output and you can rmmod the module after an "ifconfig ... down". After compiling your module, you can then insmod it without restarting the box. (Only if your module crashes, you need a restart.)

    So, you can try out quickly by compiling and testing many different things by simply guessing. You could write a short script for that and then try out what you are not really sure.
    Bus Error: Passengers dumped. Hech gap yo'q.

  7. #7
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    hard_start_xmit(struct sk_buff *skb, struct net_device *dev)

    dev->name == "eth1" for eth1:0 and eth1:1
    there is no dev->name such as "eth1:0".

  8. #8
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    Quote Originally Posted by KPal View Post
    there is no dev->name such as "eth1:0".
    You said this already in post #3. But then you said in post #5:

    "If packet from eth1:0, i need to change MAC addr int packet to XX:XX:XX:XX:XX:00, eth1:1 - :01."



    Also, if I would say: "ifconfig eth1:0 xx.xx.xx.xx", there would be one.

    But I think, you got now a pointer how to try out what you are interested in and do some changes in hard_start_xmit().
    Bus Error: Passengers dumped. Hech gap yo'q.

  9. #9
    Just Joined!
    Join Date
    May 2007
    Posts
    20
    if i write "ifconfig eth1:0 hw ether XXXXXXXXXX01" , the MAC of eth1 and eth1:1 will be the same.

  10. #10
    Linux Newbie dilbert's Avatar
    Join Date
    Sep 2006
    Location
    Yorkshire, GB
    Posts
    237
    That's the purpose of that kind of aliasing: to have more than one IP addresses on the same hardware, i.e. NIC.

    For whatever reason. I never used this and have no clue what's it good for.

    The network stack would be confused with two different MAC addresses for the same hardware as Ethernet works with a single MAC address for every endpoint.
    Bus Error: Passengers dumped. Hech gap yo'q.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •