Code Monkey home page Code Monkey logo

Comments (14)

hwmaier avatar hwmaier commented on May 27, 2024 1

My apologies for the liberty to tune into this discussion. We are also interested in the use case of using two network interfaces and using two independent sets of resources for WAN/LAN segregation purposes. The IP instance should be segregated as well for many reasons but one of them to prevent the 2nd interface from working if the first one runs out of net packets. So I think the use case @marianoizzi is describing is not that uncommon, many designs will now feature two segregated Ethernets serving different purposes.

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

@marianoizzi Our NetXDuo supports using one IP and one DHCP Client on multiple interfaces, you can refer to the sample and user guide as below to support multiple interfaces in your scenario.
sample code: https://github.com/azure-rtos/netxduo/blob/master/samples/demo_netxduo_multihome_dhcp_client.c
user guide: https://docs.microsoft.com/en-us/azure/rtos/netx-duo/netx-duo-dhcp-client/chapter1#dhcp-client-multiple-interface-support

from netxduo.

marianoizzi avatar marianoizzi commented on May 27, 2024

Agreed @bo-ms, but in the above link example both interfaces and DHCP clients are handled by the same IP instance.
In my situation I have two IP instances (one for each interface), to keep them isolated allowing different protocols/services on each interface:

status = nx_ip_create(&ip_0,"NetX IP Instance 0",
                        IP_ADDRESS(0, 0, 0, 0),
                        IP_ADDRESS(0, 0, 0, 0),
                        &pool_0,
                        nx_stm32_eth_driver,
                        ip_stack_0,
                        IP_STACK_SIZE,
                        TX_PRIO_NETX);
...
status = nx_ip_create(&ip_1,"NetX IP Instance 1",
                        IP_ADDRESS(0, 0, 0, 0),
                        IP_ADDRESS(0, 0, 0, 0),
                        &pool_1,
                        nx_ksz8851_eth_driver,
                        ip_stack_1,
                        IP_STACK_SIZE,
                        TX_PRIO_NETX);
...
status = nx_dhcp_create(&dhcp_client_0, &ip_0, "DHCP 0");
...
status = nx_dhcp_create(&dhcp_client_1, &ip_1, "DHCP 1");
...

Any suggestion?

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

@marianoizzi cloud you do following changes in nxd_dhcp_client.c and try again?

  1. Insert the code dhcp_ptr -> nx_dhcp_socket.nx_udp_socket_reserved_ptr = (VOID*)dhcp_ptr; at line381, such as:
    /* Set the UDP socket receive callback function.  */
    status = nx_udp_socket_receive_notify(&(dhcp_ptr -> nx_dhcp_socket), _nx_dhcp_udp_receive_notify);

    /* Check status.  */
    if (status != NX_SUCCESS) 
    {


#ifndef NX_DHCP_CLIENT_USER_CREATE_PACKET_POOL 
        /* Delete the packet pool.  */
        nx_packet_pool_delete(dhcp_ptr -> nx_dhcp_packet_pool_ptr);
#endif

        /* Delete the UDP socket.  */
        nx_udp_socket_delete(&(dhcp_ptr -> nx_dhcp_socket));
    }

    dhcp_ptr -> nx_dhcp_socket.nx_udp_socket_reserved_ptr = (VOID*)dhcp_ptr;
  1. Change _nx_dhcp_udp_receive_notify() as below:
VOID _nx_dhcp_udp_receive_notify(NX_UDP_SOCKET *socket_ptr)
{

NX_DHCP *dhcp_ptr;

    dhcp_ptr = (NX_DHCP *)(socket_ptr -> nx_udp_socket_reserved_ptr);

    /* Set the data received event flag.  */
    tx_event_flags_set(&(dhcp_ptr -> nx_dhcp_events), NX_DHCP_CLIENT_RECEIVE_EVENT, TX_OR);
}

from netxduo.

marianoizzi avatar marianoizzi commented on May 27, 2024

Thanks @bo-ms, just tested it and works as expected.
You may close the issue.

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

Thanks @marianoizzi, Given multiple IP instances and DHCP instances need more resources, could you provide more details about your scenario? which resource do you want to isolate? then we can check if it is necessary to have multiple instances. Thanks.

from netxduo.

marianoizzi avatar marianoizzi commented on May 27, 2024

Hi @bo-ms, the product is in an early development stage, the customer hasn't given much details yet; but I know in advance that one ethernet port will connect the device to their respective clients private networks and to an MQTT broker or BACnet server. The other port will be a management/service one, and will connect to my customer's cloud or head office server; reporting the system status (MQTT?), and providing an administration shell (SSH?).
Bests.

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

@marianoizzi, thanks for sharing the information, you do need to use two ethernet interfaces in your scenario, but I am still not sure which resource must be isolated with multiple IP and DHCP instances, do you think it is ok to isolated the resource on applications layer with one IP instance? Of course, if you have to use multiple IP instances, you can do the changes I suggested above, and please share the reason to me, we would like to learn it and improve our source code. Thanks.

from netxduo.

marianoizzi avatar marianoizzi commented on May 27, 2024

Perhaps the words "resource" and "isolation" were not the best to describe my thoughts @bo-ms; also, I understand that the multihome API provides tools to handle many configurations with one IP instance.

The scenarios I think that can't be solved with just one instance are:

  • Different networks, fixed IPs, with servers listening on the same port on both interfaces. For example two web servers listening on port 80, one on each interface.
  • Different networks, with DHCP clients on both of them.

I hope this clarifies your doubts. Thanks.

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

Perhaps the words "resource" and "isolation" were not the best to describe my thoughts @bo-ms; also, I understand that the multihome API provides tools to handle many configurations with one IP instance.

The scenarios I think that can't be solved with just one instance are:

  • Different networks, fixed IPs, with servers listening on the same port on both interfaces. For example two web servers listening on port 80, one on each interface.
  • Different networks, with DHCP clients on both of them.

I hope this clarifies your doubts. Thanks.

@marianoizzi Thanks for further clarification. In fact, one server is able to listen on both interfaces, and one DHCP client also supports on multiple interfaces with one IP, it is not necessary to have two web servers and dhcp clients. I do not fully understand the use case just yet.

from netxduo.

hwmaier avatar hwmaier commented on May 27, 2024

There are use cases where server A offers services which should only be reachable on IP address A via Ethernet interface A and likewise with server B. So if server B must not be accessible from Ethernet interface A it would need to be on a different IP stack or am I mistaken?

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

My apologies for the liberty to tune into this discussion. We are also interested in the use case of using two network interfaces and using two independent sets of resources for WAN/LAN segregation purposes. The IP instance should be segregated as well for many reasons but one of them to prevent the 2nd interface from working if the first one runs out of net packets. So I think the use case @marianoizzi is describing is not that uncommon, many designs will now feature two segregated Ethernets serving different purposes.

Hi @hwmaier, thanks for sharing your scenario, I agreed with you, there are many designs that need two segregated ethernets. NetXDuo supports multi-homed operation (multiple interfaces) and it's also possible, but not as recommended to create multiple NetX Duo multiple IP instances. In addon protocols, some addon protocols are able to support multiple interfaces with one IP and one addon instance, such as: DHCP, some protocols are able to support multiple IP instances. Before improving the addons for adapting different scenarios (multiple interfaces or multiple IP instances), it would be great for us to know the REAL USE CASE for production, learn about what each interface looks like, and what addons protocols are used on Azure RTOS device, thanks.

from netxduo.

hwmaier avatar hwmaier commented on May 27, 2024

@bo-ms, I am happy to share more but not necessarily in this public forum as this involves internal product development details. Is there any other way to provide/discuss this via private messaging?

from netxduo.

bo-ms avatar bo-ms commented on May 27, 2024

Thanks @hwmaier, Azure RTOS support email address: [email protected]

from netxduo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.