Results 1 to 6 of 6

Thread: NicheStack - changing IP address without rebooting

  1. #1
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    1

    Default NicheStack - changing IP address without rebooting

    Hi,

    is there a way of changing IP address of the Nios2 without rebooting the whole Nios?
    Looking through the sources of iniche I can see there is only a alt_iniche_init() procedure, but nothing for shutting it down or re-starting it...

    So far I have tried something like

    Code:
                 
    tse_mac_close(0);
    delete_network_tasks();
    netmain();
    create_network_tasks();
    but instead of closing and reopening the same interface, it "discovers" a 2nd interface

    Code:
    ....................................
    prep_tse_mac 0
    Your Ethernet MAC address is 00:07:35:04:b2:77
    Static IP Address is 172.16.100.81
    prepped 1 interface, initializing...
    [tse_mac_init]
    
    ....................................
    
    iniche restart triggered...
    Deleting network tasks...DONE
    InterNiche Portable TCP/IP, v3.1
    
    Copyright 1996-2008 by InterNiche Technologies. All rights reserved.
    prep_tse_mac 1
    Your Ethernet MAC address is 00:07:35:04:b2:77
    Static IP Address is 172.16.100.64
    prepped 2 interfaces, initializing...
    [tse_mac_init]
    ....................................



    Thanks!
    Last edited by dipling; May 12th, 2014 at 08:39 AM.

  2. #2
    Join Date
    Oct 2012
    Posts
    793
    Rep Power
    1

    Default Re: NicheStack - changing IP address without rebooting

    I believe you're looking for ni_set_config(). See net.h and iface.c in the iniche files.


    Code:
    /* FUNCTION: ni_set_config()
     * 
     * set IP address and subnet for a particular device.
     *
     * PARAM1: NET ifp
     * PARAM2: struct niconfig_0 * cfg
     *
     * RETURNS: 0
     */

  3. #3
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    1

    Default Re: NicheStack - changing IP address without rebooting

    Thanks, that worked nicely (and seems safer than this solution).

  4. #4
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    1

    Default Re: NicheStack - changing IP address without rebooting

    Hi there,

    I'm reviving this thread with a follow-up question:

    is it possible to change the MAC address on the fly in NicheStack?

    I didn't consider this need at start, but yesterday I configured on a system a MAC address (possibly a reserved group) and subsequently was unable to access it via switched network.

  5. #5
    Join Date
    Nov 2009
    Posts
    105
    Rep Power
    1

    Default Re: NicheStack - changing IP address without rebooting

    Quote Originally Posted by ted View Post
    I believe you're looking for ni_set_config(). See net.h and iface.c in the iniche files.


    Code:
    /* FUNCTION: ni_set_config()
     * 
     * set IP address and subnet for a particular device.
     *
     * PARAM1: NET ifp
     * PARAM2: struct niconfig_0 * cfg
     *
     * RETURNS: 0
     */
    the proposed solution worked just fine until I realized I need the possibility to change the gateway as well. Are you aware of any such function to allow me that?

  6. #6
    Join Date
    Oct 2012
    Posts
    793
    Rep Power
    1

    Default Re: NicheStack - changing IP address without rebooting

    You probably need to write your own function to do that, as it doesn't look like there is one around already.

Similar Threads

  1. Replies: 1
    Last Post: February 26th, 2014, 04:35 PM
  2. nios2linux-1.4 -> kernel rebooting
    By pannel in forum Linux Forum
    Replies: 5
    Last Post: September 28th, 2005, 10:06 PM
  3. Why rebooting?
    By imported_sunclever in forum Linux Forum
    Replies: 3
    Last Post: September 2nd, 2005, 06:40 AM
  4. Changing the uCLinux startup address
    By GreateWhite.DK in forum General Discussion Forum
    Replies: 0
    Last Post: August 25th, 2004, 04:18 AM

Bookmarks

Posting Permissions

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