Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for tunnel IPv6 addresses #1

Open
dme opened this issue Mar 22, 2015 · 1 comment
Open

Support for tunnel IPv6 addresses #1

dme opened this issue Mar 22, 2015 · 1 comment

Comments

@dme
Copy link
Collaborator

dme commented Mar 22, 2015

My tunnel provider ($DAYJOB) has started to supply IPv6 addresses for the tunnel. ocproxy should be able to configure the lwip IPv6 stack accordingly.

@ljluestc
Copy link

#include <stdio.h>
#include <string.h>
#include <lwip/netif.h>
#include <lwip/ip_addr.h>
#include <lwip/init.h>
#include <lwip/inet.h>

#define TUNNEL_IPV6_PREFIX "2001:db8::" 

void configure_ipv6_tunnel(const char* ipv6_address) {
    ip_addr_t ipv6_addr;

    
    if (ip6addr_aton(ipv6_address, &ipv6_addr)) {
        
        struct netif* netif = netif_default; 
        netif_set_ip6_addr(netif, 0, &ipv6_addr); 
        netif_set_up(netif); 
        printf("Configured IPv6 address: %s\n", ipv6_address);
    } else {
        printf("Invalid IPv6 address: %s\n", ipv6_address);
    }
}

int main() {
    lwip_init(); 

    
    const char* tunnel_ipv6_address = TUNNEL_IPV6_PREFIX "1"; 
    configure_ipv6_tunnel(tunnel_ipv6_address);

    

    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants