{"id":3541,"date":"2015-01-26T09:06:56","date_gmt":"2015-01-26T09:06:56","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=3541"},"modified":"2018-08-21T10:42:55","modified_gmt":"2018-08-21T10:42:55","slug":"ipv6-in-freebsdlinux","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=3541","title":{"rendered":"IPv6 in FreeBSD\/Linux"},"content":{"rendered":"<h3>Linux Daemon Dienste<\/h3>\n<h4>radvd<\/h4>\n<p><a href=\"https:\/\/mirrors.bieringer.de\/Linux+IPv6-HOWTO-de\/hints-daemons-radvd.html\">Router Advertisement Daemon (radvd)<\/a> (wenn die Clients automatisch konfiguriert werden sollen)<br \/>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Radvd\">Wikipedia: Router Advertisement Daemon (radvd)<\/a>, implements link-local advertisements of IPv6 router addresses and IPv6 routing prefixes using the Neighbor Discovery Protocol (NDP) => stateless autoconfiguration<\/p>\n<h4>NAT64<\/h4>\n<p><a href=\"https:\/\/de.wikipedia.org\/wiki\/NAT64\">Wikipedia: NAT64<\/a><br \/>\n<a href=\"http:\/\/www.litech.org\/tayga\/\">TAYGA<\/a><br \/>\n<a href=\"https:\/\/sourceforge.net\/projects\/nat64\/\">NAT64 Kernel Module<\/a><br \/>\n<a href=\"https:\/\/github.com\/fln\/nat64\">github.com\/fln\/nat64<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nlink local fe80::\r\nglobal unicase 2001:\r\n\r\n\/proc\/sys\/net\/ipv6\/conf\r\nall   default   eth0   eth1   lo\r\n\r\n\/proc\/sys\/net\/ipv6\/conf\/all\/forwarding =&gt; 1\r\n\r\nwell-known prefix, z.B.\r\nNAT64   64:ff9b::\/96\r\nALG     Application Layer Gateway\r\nRR      Resource Record\r\n<\/pre>\n<h4>FreeBSD Subversion<\/h4>\n<p><a href=\"http:\/\/www.freebsd.org\/doc\/en_US.ISO8859-1\/books\/handbook\/svn.html#svn-mirrors\">Subversion Mirror Sites<\/a><\/p>\n<h4>FreeBSD VLAN<\/h4>\n<p><a href=\"http:\/\/www.cyberciti.biz\/faq\/howto-configure-freebsd-vlans-with-ifconfig-command\/\">FreeBSD VLAN Configuration<\/a><br \/>\n<a href=\"http:\/\/forum.ivorde.ro\/freebsd-adding-vlan-tagged-subinterface-using-ifconfig-t15161.html\">FreeBSD &#8211; Adding VLAN Tagged subinterface using ifconfig<\/a><\/p>\n<pre class=\"brush: cpp; title: \/usr\/include\/net\/if_vlan_var.h; notranslate\" title=\"\/usr\/include\/net\/if_vlan_var.h\">\r\nstruct  vlanreq {\r\n    char    vlr_parent&#x5B;IFNAMSIZ];\r\n    u_short vlr_tag;\r\n};\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nStep 1: create the vlan subinterface\r\n# ifconfig vlan122 create\r\n\r\nStep 2: assign it a vlan ID and vlan device:\r\n# ifconfig vlan122 vlan 122 vlandev em0\r\n\r\nStep 3: check the vlan subinterface:\r\n# ifconfig vlan122\r\nvlan122: flags=8842&amp;lt;BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500\r\n        ether 00:07:e9:a5:9b:fa\r\n        media: Ethernet autoselect (1000baseTX &amp;lt;full-duplex&amp;gt;)\r\n        status: active\r\n        vlan: 122 parent interface: em0\r\n\r\nStep 4: assign ip address:\r\n# ifconfig vlan122 10.1.122.1\/24\r\n# ifconfig vlan122 up\r\n# ifconfig vlan122\r\nvlan122: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500\r\n        ether 00:07:e9:a5:9b:fa\r\n        inet 10.1.122.1 netmask 0xffffff00 broadcast 10.1.122.255\r\n        media: Ethernet autoselect (1000baseTX &amp;lt;full-duplex&amp;gt;)\r\n        status: active\r\n        vlan: 122 parent interface: em0\r\n\r\nOr edit rc.conf:\r\ncloned_interfaces=&amp;quot;vlan0&amp;quot;\r\nifconfig_vlan0=&amp;quot;inet x.x.x.x netmask y.y.y.y vlan 2 vlandev em0&amp;quot;\r\n<\/pre>\n<h4>FreeBSD Manual Pages<\/h4>\n<p><a href=\"http:\/\/www.freebsd.org\/cgi\/man.cgi?query=getifaddrs&#038;apropos=0&#038;sektion=0&#038;manpath=FreeBSD+9.3-RELEASE&#038;arch=default&#038;format=html\">getifaddrs &#8212; get interface addresses<\/a><br \/>\n<a href=\"http:\/\/www.freebsd.org\/cgi\/man.cgi?query=ether_ntohost&#038;apropos=0&#038;sektion=0&#038;manpath=FreeBSD+9.3-RELEASE&#038;arch=default&#038;format=htmlether_ntoa_r\">ether_ntohost &#8212; Ethernet address conversion and lookup routines<\/a><\/p>\n<h4>FreeBSD Implementation<\/h4>\n<p><a href=\"http:\/\/www.zdv.uni-mainz.de\/cms-extern\/DU_4.0F\/HTML\/APS2WETE\/DLPPNDXX.HTM\">DEC Direct Data Link Interface (DLI)<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/4139405\/how-to-know-ip-address-for-interfaces-in-c\">How to know ip address for interfaces in c<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/4937529\/polling-interface-names-via-siocgifconf-in-linux\">Polling interface names via SIOCGIFCONF in Linux<\/a><br \/>\n<a href=\"http:\/\/www.shrubbery.net\/solaris9ab\/SUNWdev\/NETPROTO\/p32.html#SOCKETS-45900\">Broadcasting and Determining Network Configuration<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/9148425\/freebsd-network-interface-information\">FreeBSD: network interface information<\/a><br \/>\n<a href=\"http:\/\/lists.freebsd.org\/pipermail\/freebsd-net\/2008-July\/019025.html\">lo0 not in ioctl( SIOCGIFCONF )<\/a><br \/>\n<a href=\"http:\/\/lists.freebsd.org\/pipermail\/freebsd-net\/2008-July\/019035.html\">SOLVED: lo0 not in ioctl( SIOCGIFCONF )<\/a><br \/>\n<a href=\"http:\/\/lists.apple.com\/archives\/darwin-dev\/2006\/Aug\/msg00061.html\">How to get IPv6 address using getifaddrs and which version of glibc supports<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/23577787\/how-can-i-enumerate-the-list-of-network-devices-or-interfaces-in-c-or-c-in-fre\">How can I enumerate the list of network devices or interfaces in C or C++ in FreeBSD? [duplicate]<\/a><br \/>\n<a href=\"http:\/\/marc.info\/?l=freebsd-questions&#038;m=94708037510921&#038;w=2\">Re: ioctl programming probs<\/a><\/p>\n<p><a href=\"http:\/\/svnweb.freebsd.org\/base\/release\/10.0.0\/lib\/libc\/net\/getifaddrs.c?revision=260789&#038;view=markup\">getifaddrs.c<\/a><\/p>\n<pre class=\"brush: cpp; title: net\/if.h; notranslate\" title=\"net\/if.h\">\r\nLinux:\r\nstruct ifreq {\r\n    char ifr_name&#x5B;IFNAMSIZ]; \/* Interface name *\/\r\n    union {\r\n        struct sockaddr ifr_addr;\r\n        struct sockaddr ifr_dstaddr;\r\n        struct sockaddr ifr_broadaddr;\r\n        struct sockaddr ifr_netmask;\r\n        struct sockaddr ifr_hwaddr;\r\n        short           ifr_flags;\r\n        int             ifr_ifindex;\r\n        int             ifr_metric;\r\n        int             ifr_mtu;\r\n        struct ifmap    ifr_map;\r\n        char            ifr_slave&#x5B;IFNAMSIZ];\r\n        char            ifr_newname&#x5B;IFNAMSIZ];\r\n        char           *ifr_data;\r\n    };\r\n};\r\n\r\nstruct ifconf {\r\n    int                 ifc_len; \/* size of buffer *\/\r\n    union {\r\n        char           *ifc_buf; \/* buffer address *\/\r\n        struct ifreq   *ifc_req; \/* array of structures *\/\r\n    };\r\n};\r\n\r\nFreeBSD:\r\n\r\n\/*\r\n * Length of interface external name, including terminating '&#92;&#48;'.\r\n * Note: this is the same size as a generic device's external name.\r\n *\/\r\n#define         IF_NAMESIZE     16\r\n#if __BSD_VISIBLE\r\n#define         IFNAMSIZ        IF_NAMESIZE\r\n#define         IF_MAXUNIT      0x7fff  \/* historical value *\/\r\n#endif\r\n#if __BSD_VISIBLE\r\n\r\n\/*\r\n * Interface request structure used for socket\r\n * ioctl's.  All interface ioctl's must have parameter\r\n * definitions which begin with ifr_name.  The\r\n * remainder may be interface specific.\r\n *\/\r\nstruct  ifreq {\r\n        char    ifr_name&#x5B;IFNAMSIZ];             \/* if name, e.g. &amp;quot;en0&amp;quot; *\/\r\n        union {\r\n                struct  sockaddr ifru_addr;\r\n                struct  sockaddr ifru_dstaddr;\r\n                struct  sockaddr ifru_broadaddr;\r\n                struct  ifreq_buffer ifru_buffer;\r\n                short   ifru_flags&#x5B;2];\r\n                short   ifru_index;\r\n                int     ifru_jid;\r\n                int     ifru_metric;\r\n                int     ifru_mtu;\r\n                int     ifru_phys;\r\n                int     ifru_media;\r\n                caddr_t ifru_data;\r\n                int     ifru_cap&#x5B;2];\r\n                u_int   ifru_fib;\r\n        } ifr_ifru;\r\n#define ifr_addr        ifr_ifru.ifru_addr      \/* address *\/\r\n#define ifr_dstaddr     ifr_ifru.ifru_dstaddr   \/* other end of p-to-p link *\/\r\n#define ifr_broadaddr   ifr_ifru.ifru_broadaddr \/* broadcast address *\/\r\n#define ifr_buffer      ifr_ifru.ifru_buffer    \/* user supplied buffer with its length *\/\r\n#define ifr_flags       ifr_ifru.ifru_flags&#x5B;0]  \/* flags (low 16 bits) *\/\r\n#define ifr_flagshigh   ifr_ifru.ifru_flags&#x5B;1]  \/* flags (high 16 bits) *\/\r\n#define ifr_jid         ifr_ifru.ifru_jid       \/* jail\/vnet *\/\r\n#define ifr_metric      ifr_ifru.ifru_metric    \/* metric *\/\r\n#define ifr_mtu         ifr_ifru.ifru_mtu       \/* mtu *\/\r\n#define ifr_phys        ifr_ifru.ifru_phys      \/* physical wire *\/\r\n#define ifr_media       ifr_ifru.ifru_media     \/* physical media *\/\r\n#define ifr_data        ifr_ifru.ifru_data      \/* for use by interface *\/\r\n#define ifr_reqcap      ifr_ifru.ifru_cap&#x5B;0]    \/* requested capabilities *\/\r\n#define ifr_curcap      ifr_ifru.ifru_cap&#x5B;1]    \/* current capabilities *\/\r\n#define ifr_index       ifr_ifru.ifru_index     \/* interface index *\/\r\n#define ifr_fib         ifr_ifru.ifru_fib       \/* interface fib *\/\r\n};\r\n\r\n\r\n\/*\r\n * Structure used in SIOCGIFCONF request.\r\n * Used to retrieve interface configuration\r\n * for machine (useful for programs which\r\n * must know all networks accessible).\r\n *\/\r\nstruct  ifconf {\r\n        int     ifc_len;                \/* size of associated buffer *\/\r\n        union {\r\n                caddr_t ifcu_buf;\r\n                struct  ifreq *ifcu_req;\r\n        } ifc_ifcu;\r\n#define ifc_buf ifc_ifcu.ifcu_buf       \/* buffer address *\/\r\n#define ifc_req ifc_ifcu.ifcu_req       \/* array of structures returned *\/\r\n};\r\n\r\n\/*-\r\n * Interface flags are of two types: network stack owned flags, and driver\r\n * owned flags.  Historically, these values were stored in the same ifnet\r\n * flags field, but with the advent of fine-grained locking, they have been\r\n * broken out such that the network stack is responsible for synchronizing\r\n * the stack-owned fields, and the device driver the device-owned fields.\r\n * Both halves can perform lockless reads of the other half's field, subject\r\n * to accepting the involved races.\r\n *\r\n * Both sets of flags come from the same number space, and should not be\r\n * permitted to conflict, as they are exposed to user space via a single\r\n * field.\r\n *\r\n * The following symbols identify read and write requirements for fields:\r\n *\r\n * (i) if_flags field set by device driver before attach, read-only there\r\n *     after.\r\n * (n) if_flags field written only by the network stack, read by either the\r\n *     stack or driver.\r\n * (d) if_drv_flags field written only by the device driver, read by either\r\n *     the stack or driver.\r\n *\/\r\n#define IFF_UP          0x1             \/* (n) interface is up *\/\r\n#define IFF_BROADCAST   0x2             \/* (i) broadcast address valid *\/\r\n#define IFF_DEBUG       0x4             \/* (n) turn on debugging *\/\r\n#define IFF_LOOPBACK    0x8             \/* (i) is a loopback net *\/\r\n#define IFF_POINTOPOINT 0x10            \/* (i) is a point-to-point link *\/\r\n#define IFF_SMART       0x20            \/* (i) interface manages own routes *\/\r\n#define IFF_DRV_RUNNING 0x40            \/* (d) resources allocated *\/\r\n#define IFF_NOARP       0x80            \/* (n) no address resolution protocol *\/\r\n#define IFF_PROMISC     0x100           \/* (n) receive all packets *\/\r\n#define IFF_ALLMULTI    0x200           \/* (n) receive all multicast packets *\/\r\n#define IFF_DRV_OACTIVE 0x400           \/* (d) tx hardware queue is full *\/\r\n#define IFF_SIMPLEX     0x800           \/* (i) can't hear own transmissions *\/\r\n#define IFF_LINK0       0x1000          \/* per link layer defined bit *\/\r\n#define IFF_LINK1       0x2000          \/* per link layer defined bit *\/\r\n#define IFF_LINK2       0x4000          \/* per link layer defined bit *\/\r\n#define IFF_ALTPHYS     IFF_LINK2       \/* use alternate physical connection *\/\r\n#define IFF_MULTICAST   0x8000          \/* (i) supports multicast *\/\r\n#define IFF_CANTCONFIG  0x10000         \/* (i) unconfigurable using ioctl(2) *\/\r\n#define IFF_PPROMISC    0x20000         \/* (n) user-requested promisc mode *\/\r\n#define IFF_MONITOR     0x40000         \/* (n) user-requested monitor mode *\/\r\n#define IFF_STATICARP   0x80000         \/* (n) static ARP *\/\r\n#define IFF_DYING       0x200000        \/* (n) interface is winding down *\/\r\n#define IFF_RENAMING    0x400000        \/* (n) interface is being renamed *\/\r\n<\/pre>\n<pre class=\"brush: cpp; title: lwip\/; notranslate\" title=\"lwip\/\">\r\n\/* Throughout this file, IP addresses are expected to be in\r\n * the same byte order as in IP_PCB. *\/\r\n\r\n\/** must be the maximum of all used hardware address lengths\r\n    across all types of interfaces in use *\/\r\n#define NETIF_MAX_HWADDR_LEN 6U\r\n\r\n\/** Whether the network interface is 'up'. This is\r\n * a software flag used to control whether this network\r\n * interface is enabled and processes traffic.\r\n * It is set by the startup code (for static IP configuration) or\r\n * by dhcp\/autoip when an address has been assigned.\r\n *\/\r\n#define NETIF_FLAG_UP           0x01U\r\n\/** If set, the netif has broadcast capability.\r\n * Set by the netif driver in its init function. *\/\r\n#define NETIF_FLAG_BROADCAST    0x02U\r\n\/** If set, the netif is one end of a point-to-point connection.\r\n * Set by the netif driver in its init function. *\/\r\n#define NETIF_FLAG_POINTTOPOINT 0x04U\r\n\/** If set, the interface is configured using DHCP.\r\n * Set by the DHCP code when starting or stopping DHCP. *\/\r\n#define NETIF_FLAG_DHCP         0x08U\r\n\/** If set, the interface has an active link\r\n *  (set by the network interface driver).\r\n * Either set by the netif driver in its init function (if the link\r\n * is up at that time) or at a later point once the link comes up\r\n * (if link detection is supported by the hardware). *\/\r\n#define NETIF_FLAG_LINK_UP      0x10U\r\n\/** If set, the netif is an ethernet device using ARP.\r\n * Set by the netif driver in its init function.\r\n * Used to check input packet types and use of DHCP. *\/\r\n#define NETIF_FLAG_ETHARP       0x20U\r\n\/** If set, the netif is an ethernet device. It might not use\r\n * ARP or TCP\/IP if it is used for PPPoE only.\r\n *\/\r\n#define NETIF_FLAG_ETHERNET     0x40U\r\n\/** If set, the netif has IGMP capability.\r\n * Set by the netif driver in its init function. *\/\r\n#define NETIF_FLAG_IGMP         0x80U\r\n\r\n\/** Generic data structure used for all lwIP network interfaces.\r\n *  The following fields should be filled in by the initialization\r\n *  function for the device driver: hwaddr_len, hwaddr&#x5B;], mtu, flags *\/\r\nstruct netif {\r\n    \/** pointer to next in linked list *\/\r\n    struct netif *next;\r\n    \r\n    \/** IP address configuration in network byte order *\/\r\n    ip_addr_t ip_addr;\r\n    ip_addr_t netmask;\r\n    ip_addr_t gw;\r\n    \r\n    \/*** LWIP_IPV6 ***********************************************************\/\r\n    \/** Array of IPv6 addresses for this netif. *\/\r\n    ip6_addr_t ip6_addr&#x5B;LWIP_IPV6_NUM_ADDRESSES];\r\n    \/** The state of each IPv6 address (Tentative, Preferred, etc).\r\n     * @see ip6_addr.h *\/\r\n    u8_t ip6_addr_state&#x5B;LWIP_IPV6_NUM_ADDRESSES];\r\n\r\n    \/** This function is called by the network device driver\r\n     *  to pass a packet up the TCP\/IP stack. *\/\r\n    netif_input_fn input;\r\n    \/** This function is called by the IP module when it wants\r\n     *  to send a packet on the interface. This function typically\r\n     *  first resolves the hardware address, then sends the packet. *\/\r\n    netif_output_fn output;\r\n    \/** This function is called by the ARP module when it wants\r\n     *  to send a packet on the interface. This function outputs\r\n     *  the pbuf as-is on the link medium. *\/\r\n    netif_linkoutput_fn linkoutput;\r\n    \r\n    \/*** LWIP_IPV6 ***********************************************************\/\r\n    \/** This function is called by the IPv6 module when it wants\r\n     *  to send a packet on the interface. This function typically\r\n     *  first resolves the hardware address, then sends the packet. *\/\r\n     netif_output_ip6_fn output_ip6;\r\n    \r\n    \/*** LWIP_NETIF_STATUS_CALLBACK ******************************************\/\r\n    \/** This function is called when the netif state is set to up or down *\/\r\n    netif_status_callback_fn status_callback;\r\n    \r\n    \/*** LWIP_NETIF_LINK_CALLBACK ********************************************\/\r\n    \/** This function is called when the netif link is set to up or down *\/\r\n    netif_status_callback_fn link_callback;\r\n    \r\n    \/*** LWIP_NETIF_REMOVE_CALLBACK ******************************************\/\r\n    \/** This function is called when the netif has been removed *\/\r\n    netif_status_callback_fn remove_callback;\r\n    \r\n    \/** This field can be set by the device driver and could point\r\n     *  to state information for the device. *\/\r\n    void *state;\r\n    \r\n    \/*** LWIP_DHCP ***********************************************************\/\r\n    \/** the DHCP client state information for this netif *\/\r\n    struct dhcp *dhcp;\r\n    \r\n    \/*** LWIP_AUTOIP *********************************************************\/\r\n    \/** the AutoIP client state information for this netif *\/\r\n    struct autoip *autoip;\r\n    \r\n    \/*** LWIP_IPV6_AUTOCONFIG ************************************************\/\r\n    \/** is this netif enabled for IPv6 autoconfiguration *\/\r\n    u8_t ip6_autoconfig_enabled;\r\n    \r\n    \/*** LWIP_IPV6_SEND_ROUTER_SOLICIT ***************************************\/\r\n    \/** Number of Router Solicitation messages that remain to be sent. *\/\r\n    u8_t rs_count;\r\n    \r\n    \/*** LWIP_IPV6_DHCP6 *****************************************************\/\r\n    \/** the DHCPv6 client state information for this netif *\/\r\n    struct dhcp6 *dhcp6;\r\n    \r\n    \/*** LWIP_NETIF_HOSTNAME *************************************************\/\r\n    \/* the hostname for this netif, NULL is a valid value *\/\r\n    char*  hostname;\r\n    \r\n    \/** maximum transfer unit (in bytes) *\/\r\n    u16_t mtu;\r\n    \/** number of bytes used in hwaddr *\/\r\n    u8_t hwaddr_len;\r\n    \/** link level hardware address of this interface *\/\r\n    u8_t hwaddr&#x5B;NETIF_MAX_HWADDR_LEN];\r\n    \/** flags (see NETIF_FLAG_ above) *\/\r\n    u8_t flags;\r\n    \/** descriptive abbreviation *\/\r\n    char name&#x5B;2];\r\n    \/** number of this interface *\/\r\n    u8_t num;\r\n    \r\n    \/*** LWIP_SNMP ***********************************************************\/\r\n    \/** link type (from &amp;quot;snmp_ifType&amp;quot; enum from snmp.h) *\/\r\n    u8_t link_type;\r\n    \/** (estimate) link speed *\/\r\n    u32_t link_speed;\r\n    \/** timestamp at last change made (up\/down) *\/\r\n    u32_t ts;\r\n    \/** counters *\/\r\n    u32_t ifinoctets;\r\n    u32_t ifinucastpkts;\r\n    u32_t ifinnucastpkts;\r\n    u32_t ifindiscards;\r\n    u32_t ifoutoctets;\r\n    u32_t ifoutucastpkts;\r\n    u32_t ifoutnucastpkts;\r\n    u32_t ifoutdiscards;\r\n    \r\n    \/*** LWIP_IGMP ***********************************************************\/\r\n    \/** This function could be called to add or delete a entry in the multicast\r\n     *  filter table of the ethernet MAC.*\/\r\n    netif_igmp_mac_filter_fn igmp_mac_filter;\r\n    \r\n    \/*** LWIP_IPV6 &amp;amp;&amp;amp; LWIP_IPV6_MLD ******************************************\/\r\n    \/** This function could be called to add or delete an entry in the IPv6 multicast\r\n     *  filter table of the ethernet MAC. *\/\r\n    netif_mld_mac_filter_fn mld_mac_filter;\r\n    \r\n    \/*** LWIP_NETIF_HWADDRHINT ***********************************************\/\r\n    u8_t *addr_hint;\r\n    \r\n    \/*** ENABLE_LOOPBACK *****************************************************\/\r\n    \/* List of packets to be queued for ourselves. *\/\r\n    struct pbuf *loop_first;\r\n    struct pbuf *loop_last;\r\n    \r\n    u16_t loop_cnt_current;\r\n};\r\n<\/pre>\n<pre class=\"brush: cpp; title: \/usr\/include\/sys\/sockio.h; notranslate\" title=\"\/usr\/include\/sys\/sockio.h\">\r\n#define SIOCSIFPHYADDR   _IOW('i', 70, struct ifaliasreq) \/* set gif addres *\/\r\n#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq)    \/* get gif psrc addr *\/\r\n#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq)    \/* get gif pdst addr *\/\r\n<\/pre>\n<pre class=\"brush: cpp; title: \/usr\/include\/netinet6\/nd6.h; notranslate\" title=\"\/usr\/include\/netinet6\/nd6.h\">\r\nstruct nd_ifinfo {\r\n    u_int32_t linkmtu;              \/* LinkMTU *\/\r\n    u_int32_t maxmtu;               \/* Upper bound of LinkMTU *\/\r\n    u_int32_t basereachable;        \/* BaseReachableTime *\/\r\n    u_int32_t reachable;            \/* Reachable Time *\/\r\n    u_int32_t retrans;              \/* Retrans Timer *\/\r\n    u_int32_t flags;                \/* Flags *\/\r\n    int recalctm;                   \/* BaseReacable re-calculation timer *\/\r\n    u_int8_t chlim;                 \/* CurHopLimit *\/\r\n    u_int8_t initialized;           \/* Flag to see the entry is initialized *\/\r\n    \r\n    \/* the following 3 members are for privacy extension for addrconf *\/\r\n    u_int8_t randomseed0&#x5B;8];        \/* upper 64 bits of MD5 digest *\/\r\n    u_int8_t randomseed1&#x5B;8];        \/* lower 64 bits (usually the EUI64 IFID) *\/\r\n    u_int8_t randomid&#x5B;8];           \/* current random ID *\/\r\n};\r\n\r\nstruct  in6_ndireq {\r\n    char ifname&#x5B;IFNAMSIZ];\r\n    struct nd_ifinfo ndi;\r\n};\r\n\r\nstruct in6_ndireq nd;\r\n\r\nmemset(&amp;amp;nd, 0, sizeof(nd));\r\nstrncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));\r\nerror = ioctl(s, SIOCGIFINFO_IN6, &amp;amp;nd);\r\n<\/pre>\n<pre class=\"brush: cpp; title: net\/if_dl.h; notranslate\" title=\"net\/if_dl.h\">\r\n\/*\r\n * Structure of a Link-Level sockaddr:\r\n *\/\r\nstruct sockaddr_dl {\r\n        u_char  sdl_len;        \/* Total length of sockaddr *\/\r\n        u_char  sdl_family;     \/* AF_LINK *\/\r\n        u_short sdl_index;      \/* if != 0, system given index for interface *\/\r\n        u_char  sdl_type;       \/* interface type *\/\r\n        u_char  sdl_nlen;       \/* interface name length, no trailing 0 reqd. *\/\r\n        u_char  sdl_alen;       \/* link level address length *\/\r\n        u_char  sdl_slen;       \/* link layer selector length *\/\r\n        char    sdl_data&#x5B;46];   \/* minimum work area, can be larger;\r\n                                   contains both if name and ll address *\/\r\n};\r\n<\/pre>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n$2  = {sdl_len = 56 '8', sdl_family = 18 (AF_LINK), sdl_index = 1, sdl_type = 0x06 (IFT_ETHER), sdl_nlen = 3, sdl_alen = 6, sdl_slen = 0, sdl_data = &amp;quot;vr0&amp;quot;, ...}\r\n$13 = {sdl_len = 56 '8', sdl_family = 18 (AF_LINK), sdl_index = 2, sdl_type = 0x06 (IFT_ETHER), sdl_nlen = 3, sdl_alen = 6, sdl_slen = 0, sdl_data = &amp;quot;vr1&amp;quot;, ...}\r\n$14 = {sdl_len = 56 '8', sdl_family = 18 (AF_LINK), sdl_index = 3, sdl_type = 0x06 (IFT_ETHER), sdl_nlen = 3, sdl_alen = 6, sdl_slen = 0, sdl_data = &amp;quot;vr2&amp;quot;, ...}\r\n$15 = {sdl_len = 56 '8', sdl_family = 18 (AF_LINK), sdl_index = 4, sdl_type = 0x18 (IFT_LOOP),  sdl_nlen = 3, sdl_alen = 0, sdl_slen = 0, sdl_data = &amp;quot;lo0&amp;quot;, ...}\r\n$16 = {sdl_len = 56 '8', sdl_family = 18 (AF_LINK), sdl_index = 5, sdl_type = 0xf6 (IFT_PFLOG), sdl_nlen = 6, sdl_alen = 0, sdl_slen = 0, sdl_data = &amp;quot;pflog0&amp;quot;, ...}\r\n\r\nsdl-&amp;gt;sdl_nlen   \/* interface name length, no trailing 0 reqd. *\/\r\nsdl-&amp;gt;sdl_alen   \/* link level address length *\/\r\n\r\nsdl-&amp;gt;sdl_type:\r\n\/usr\/include\/net\/if_types.h\r\n#define\tIFT_ETHER\t0x6\t\t\/* Ethernet CSMA\/CD *\/\r\n#define\tIFT_LOOP\t0x18\t\t\/* loopback *\/\r\n#define\tIFT_PFLOG\t0xf6            \/* PF firewall *\/\r\n<\/pre>\n<pre class=\"brush: cpp; title: linux\/if_ether.h; notranslate\" title=\"linux\/if_ether.h\">\r\n#define ETH_ALEN\t6\t\t\/* Octets in one ethernet addr\t *\/\r\n<\/pre>\n<pre class=\"brush: cpp; title: net\/ethernet.h; notranslate\" title=\"net\/ethernet.h\">\r\nLinux:\r\n\r\n#define ETHER_ADDR_LEN  ETH_ALEN                 \/* size of ethernet addr *\/\r\n\r\n\/* This is a name for the 48 bit ethernet address available on many\r\n   systems.  *\/\r\nstruct ether_addr\r\n{\r\n  u_int8_t ether_addr_octet&#x5B;ETH_ALEN];\r\n} __attribute__ ((__packed__));\r\n\r\n\r\nFreeBSD:\r\n\/*\r\n* The number of bytes in an\tethernet (MAC) address.\r\n*\/\r\n#define ETHER_ADDR_LEN\t   6\r\n\r\n\/*\r\n* Structure\tof a 48-bit Ethernet address.\r\n*\/\r\nstruct  ether_addr {\r\n   u_char octet&#x5B;ETHER_ADDR_LEN];\r\n};\r\n\r\n<\/pre>\n<p><a href=\"http:\/\/www.shrubbery.net\/solaris9ab\/SUNWdev\/NETPROTO\/p33.html\">Do SIOCGIFNUM ioctl to find the number of interfaces<\/a><\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\/*\r\n * Do SIOCGIFNUM ioctl to find the number of interfaces\r\n *\r\n * Allocate space for number of interfaces found\r\n *\r\n * Do SIOCGIFCONF with allocated buffer\r\n *\r\n *\/\r\nif (ioctl(s, SIOCGIFNUM, (char *)&amp;amp;numifs) == -1) {\r\n    numifs = MAXIFS;\r\n}\r\nbufsize = numifs * sizeof(struct ifreq);\r\nreqbuf = (struct ifreq *) malloc(bufsize);\r\nif (reqbuf == NULL) {\r\n    fprintf(stderr, &amp;quot;out of memory\\n&amp;quot;);\r\n    exit(1);\r\n}\r\nifc.ifc_buf = (caddr_t)&amp;amp;reqbuf&#x5B;0];\r\nifc.ifc_len = bufsize;\r\nif (ioctl(s, SIOCGIFCONF, (char *)&amp;amp;ifc) == -1) {\r\n    perror(&amp;quot;ioctl(SIOCGIFCONF)&amp;quot;);\r\n    exit(1);\r\n}\r\n<\/pre>\n<p><a href=\"http:\/\/forums.devshed.com\/programming-42\/ioctl-sockfd-siocgifconf-ifc-159495.html\">ioctl(sockfd, SIOCGIFCONF, &#038;ifc)<\/a><\/p>\n<pre class=\"brush: plain; title: Source; notranslate\" title=\"Source\">\r\n\r\n<\/pre>\n<pre class=\"brush: plain; title: Console; notranslate\" title=\"Console\">\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Linux Daemon Dienste radvd Router Advertisement Daemon (radvd) (wenn die Clients automatisch konfiguriert werden sollen) Wikipedia: Router Advertisement Daemon (radvd), implements link-local advertisements of IPv6 router addresses and IPv6 routing prefixes using the Neighbor Discovery Protocol (NDP) => stateless autoconfiguration NAT64 Wikipedia: NAT64 TAYGA NAT64 Kernel Module github.com\/fln\/nat64 link local fe80:: global unicase 2001: \/proc\/sys\/net\/ipv6\/conf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3541","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3541"}],"version-history":[{"count":7,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3541\/revisions"}],"predecessor-version":[{"id":8027,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3541\/revisions\/8027"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}