找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
楼主: small_5

新版N2N_V2+LUCI(全平台)

 火... [复制链接]
发表于 2017-11-20 14:02 | 显示全部楼层
收藏了。谢谢楼主分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-11-20 14:07 来自手机 | 显示全部楼层
lhx11187 发表于 2017-11-20 12:18
P2P的穿透太难,我是移动大内网,都是需要转发的,可以用zerotier

移动不清楚,我这电信和联通都是内网ip的情况下可以穿,因为2边都是nat2。移动只要出口不做nat应该也是nat2才对。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-11-20 14:08 来自手机 | 显示全部楼层
而且zerotier跟n2n原理差不多的,就是一个服务端自己的,一个第三方的,能否穿透就由2边nat类型决定
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-11-25 22:49 | 显示全部楼层
还没测试,准备试一下n2n。请问下那个新参数 添加本地IP是什么个用法和意思?,不太理解,可否举个例子?

点评

已回答  发表于 2017-12-22 10:51
比如: edge -a 10.0.0.11 -c test -L 192.168.1.111 -l n2n.lucktu.com:10082 -M 1300 -r -b & 其中 192.168.1.111 是实际本机的内网物理IP地址。  详情 回复 发表于 2017-12-22 10:50
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-11-27 17:21 | 显示全部楼层
small_5 发表于 2017-11-14 12:08
同城电信+联通的延迟,还行,上行也可以跑满,旧版本的在我这儿打不起洞。

相关源代码,

  1. /*
  2. *  TP-LINK TL-WR881N v1 board support
  3. *
  4. *  Copyright (C) 2016 Alexander Wang <limin2016@yahoo.com>
  5. *  Copyright (C) 2015 Weijie Gao <hackpacsal@gmail.com>
  6. *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
  7. *
  8. *  This program is free software; you can redistribute it and/or modify it
  9. *  under the terms of the GNU General Public License version 2 as published
  10. *  by the Free Software Foundation.
  11. */

  12. #include <linux/pci.h>
  13. #include <linux/phy.h>
  14. #include <linux/gpio.h>
  15. #include <linux/delay.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/ath9k_platform.h>
  20. #include <linux/ar8216_platform.h>

  21. #include <asm/mach-ath79/ath79.h>
  22. #include <asm/mach-ath79/ar71xx_regs.h>

  23. #include "pci.h"
  24. #include "common.h"
  25. #include "dev-ap9x-pci.h"
  26. #include "dev-eth.h"
  27. #include "dev-gpio-buttons.h"
  28. #include "dev-leds-gpio.h"
  29. #include "dev-m25p80.h"
  30. #include "dev-spi.h"
  31. #include "dev-wmac.h"
  32. #include "machtypes.h"

  33. #define WR881NV1_GPIO_LED_WLAN  12
  34. #define WR881NV1_GPIO_LED_SYSTEM  19
  35. #define WR881NV1_GPIO_LED_WPS 15

  36. #define WR881NV1_GPIO_BTN_RESET 16

  37. #define WR881NV1_KEYS_POLL_INTERVAL 20        /* msecs */
  38. #define WR881NV1_KEYS_DEBOUNCE_INTERVAL (3 * WR881NV1_KEYS_POLL_INTERVAL)

  39. #define ATH_MII_MGMT_CMD  0x24
  40. #define ATH_MGMT_CMD_READ 0x1

  41. #define ATH_MII_MGMT_ADDRESS  0x28
  42. #define ATH_ADDR_SHIFT  8

  43. #define ATH_MII_MGMT_CTRL 0x2c
  44. #define ATH_MII_MGMT_STATUS 0x30

  45. #define ATH_MII_MGMT_IND  0x34
  46. #define ATH_MGMT_IND_BUSY (1 << 0)
  47. #define ATH_MGMT_IND_INVALID  (1 << 2)

  48. #define WR881NV1_WMAC_CALDATA_OFFSET  0x1000

  49. #define QCA955X_ETH_CFG_GMAC0_EN  BIT(1)
  50. #define QCA955X_ETH_CFG_GMAC0_SLAVE BIT(4)

  51. static const char *wr881nv1_part_probes[] = {
  52.         "tp-link",
  53.         NULL,
  54. };

  55. static struct flash_platform_data wr881nv1_flash_data = {
  56.         .part_probes        = wr881nv1_part_probes,
  57. };

  58. static struct gpio_led wr881nv1_leds_gpio[] __initdata = {
  59.         {
  60.                 .name                = "tp-link:green:wps",
  61.                 .gpio                = WR881NV1_GPIO_LED_WPS,
  62.                 .active_low        = 1,
  63.         },
  64.         {
  65.                 .name                = "tp-link:green:system",
  66.                 .gpio                = WR881NV1_GPIO_LED_SYSTEM,
  67.                 .active_low        = 1,
  68.         },
  69.         {
  70.                 .name                = "tp-link:green:wlan",
  71.                 .gpio                = WR881NV1_GPIO_LED_WLAN,
  72.                 .active_low        = 1,
  73.         },
  74. };

  75. static struct gpio_keys_button wr881nv1_gpio_keys[] __initdata = {
  76.         {
  77.                 .desc                = "reset",
  78.                 .type                = EV_KEY,
  79.                 .code                = KEY_RESTART,
  80.                 .debounce_interval = WR881NV1_KEYS_DEBOUNCE_INTERVAL,
  81.                 .gpio                = WR881NV1_GPIO_BTN_RESET,
  82.                 .active_low        = 1,
  83.         },
  84. };

  85. static struct mdio_board_info wr881nv1_mdio0_info[] = {
  86.         {
  87.                 .bus_id = "ag71xx-mdio.0",
  88.                 .phy_addr = 0,
  89.                 .platform_data = NULL,
  90.         },
  91. };

  92. static unsigned long __init ath_gmac_reg_rd(unsigned long reg)
  93. {
  94.         void __iomem *base;
  95.         unsigned long t;

  96.         base = ioremap(AR71XX_GE0_BASE, AR71XX_GE0_SIZE);

  97.         t = __raw_readl(base + reg);

  98.         iounmap(base);

  99.         return t;
  100. }

  101. static void __init ath_gmac_reg_wr(unsigned long reg, unsigned long value)
  102. {
  103.         void __iomem *base;
  104.         unsigned long t = value;

  105.         base = ioremap(AR71XX_GE0_BASE, AR71XX_GE0_SIZE);

  106.         __raw_writel(t, base + reg);

  107.         iounmap(base);
  108. }

  109. static void __init phy_reg_write(unsigned char phy_addr, unsigned char reg, unsigned short data)
  110. {
  111.         unsigned short addr = (phy_addr << ATH_ADDR_SHIFT) | reg;
  112.         volatile int rddata;
  113.         unsigned short ii = 0xFFFF;

  114.         do
  115.         {
  116.                 udelay(5);
  117.                 rddata = ath_gmac_reg_rd(ATH_MII_MGMT_IND) & 0x1;
  118.         } while (rddata && --ii);

  119.         ath_gmac_reg_wr(ATH_MII_MGMT_ADDRESS, addr);
  120.         ath_gmac_reg_wr(ATH_MII_MGMT_CTRL, data);

  121.         do
  122.         {
  123.                 udelay(5);
  124.                 rddata = ath_gmac_reg_rd(ATH_MII_MGMT_IND) & 0x1;
  125.         } while (rddata && --ii);
  126. }

  127. static unsigned short __init phy_reg_read(unsigned char phy_addr, unsigned char reg)
  128. {
  129.         unsigned short addr = (phy_addr << ATH_ADDR_SHIFT) | reg, val;
  130.         volatile int rddata;
  131.         unsigned short ii = 0xffff;

  132.         do
  133.         {
  134.                 udelay(5);
  135.                 rddata = ath_gmac_reg_rd(ATH_MII_MGMT_IND) & 0x1;
  136.         } while (rddata && --ii);

  137.         ath_gmac_reg_wr(ATH_MII_MGMT_CMD, 0x0);
  138.         ath_gmac_reg_wr(ATH_MII_MGMT_ADDRESS, addr);
  139.         ath_gmac_reg_wr(ATH_MII_MGMT_CMD, ATH_MGMT_CMD_READ);

  140.         do
  141.         {
  142.                 udelay(5);
  143.                 rddata = ath_gmac_reg_rd(ATH_MII_MGMT_IND) & 0x1;
  144.         } while (rddata && --ii);

  145.         val = ath_gmac_reg_rd(ATH_MII_MGMT_STATUS);
  146.         ath_gmac_reg_wr(ATH_MII_MGMT_CMD, 0x0);

  147.         return val;
  148. }

  149. static void __init athrs27_reg_write(unsigned int s27_addr, unsigned int s27_write_data)
  150. {
  151.         unsigned int addr_temp;
  152.         unsigned int data;
  153.         unsigned char phy_address, reg_address;

  154.         addr_temp = (s27_addr) >> 2;
  155.         data = addr_temp >> 7;

  156.         phy_address = 0x1f;
  157.         reg_address = 0x10;

  158.         phy_reg_write(phy_address, reg_address, data);

  159.         phy_address = (0x17 & ((addr_temp >> 4) | 0x10));

  160.         reg_address = (((addr_temp << 1) & 0x1e) | 0x1);
  161.         data = (s27_write_data >> 16) & 0xffff;
  162.         phy_reg_write(phy_address, reg_address, data);

  163.         reg_address = ((addr_temp << 1) & 0x1e);
  164.         data = s27_write_data  & 0xffff;
  165.         phy_reg_write(phy_address, reg_address, data);
  166. }

  167. static unsigned int __init athrs27_reg_read(unsigned int s27_addr)
  168. {
  169.         unsigned int addr_temp;
  170.         unsigned int s27_rd_csr_low, s27_rd_csr_high, s27_rd_csr;
  171.         unsigned int data;
  172.         unsigned char phy_address, reg_address;

  173.         addr_temp = s27_addr >>2;
  174.         data = addr_temp >> 7;

  175.         phy_address = 0x1f;
  176.         reg_address = 0x10;

  177.         phy_reg_write(phy_address, reg_address, data);

  178.         phy_address = (0x17 & ((addr_temp >> 4) | 0x10));
  179.         reg_address = ((addr_temp << 1) & 0x1e);
  180.         s27_rd_csr_low = (unsigned int) phy_reg_read(phy_address, reg_address);

  181.         reg_address = reg_address | 0x1;
  182.         s27_rd_csr_high = (unsigned int) phy_reg_read(phy_address, reg_address);
  183.         s27_rd_csr = (s27_rd_csr_high << 16) | s27_rd_csr_low ;
  184.        
  185.         return (s27_rd_csr);
  186. }

  187. static void __init ar8236_reset(void)
  188. {
  189.         unsigned short i = 30;

  190.         athrs27_reg_write(0x0, athrs27_reg_read(0x0) | 0x80000000);
  191.         while (i--)
  192.         {
  193.                 mdelay(100);
  194.                 if (!(athrs27_reg_read(0x0) & 0x80000000))
  195.                 break;
  196.         }
  197. }

  198. static void __init wr881nv1_setup(void)
  199. {
  200.         u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  201.         u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
  202.         u8 tmpmac[ETH_ALEN];

  203.         ath79_register_m25p80(&wr881nv1_flash_data);
  204.        
  205.         ath79_register_pci();
  206.        
  207.         ath79_init_mac(tmpmac, mac, 0);
  208.         ath79_register_wmac(art + WR881NV1_WMAC_CALDATA_OFFSET, tmpmac);

  209.         ath79_register_mdio(0, 0x0);
  210.        
  211.         mdiobus_register_board_info(wr881nv1_mdio0_info,
  212.                                     ARRAY_SIZE(wr881nv1_mdio0_info));

  213.         ar8236_reset();
  214.        
  215.         ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_GMAC0_EN | QCA955X_ETH_CFG_GMAC0_SLAVE);
  216.   
  217.         /* WAN */
  218.         ath79_register_eth(1);
  219.         ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);

  220.         /* GMAC0 is connected to the PHY0 of the AR8236 switch, GE0 */
  221.         ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  222.         ath79_eth1_data.duplex = DUPLEX_FULL;
  223.         ath79_eth1_data.speed = SPEED_100;
  224.         ath79_eth1_data.phy_mask = BIT(0);
  225.         ath79_eth1_data.mii_bus_dev = &ath79_mdio0_device.dev;
  226.        
  227.         ath79_register_leds_gpio(-1, ARRAY_SIZE(wr881nv1_leds_gpio),
  228.                                  wr881nv1_leds_gpio);
  229.         ath79_register_gpio_keys_polled(-1, WR881NV1_KEYS_POLL_INTERVAL,
  230.                                         ARRAY_SIZE(wr881nv1_gpio_keys),
  231.                                         wr881nv1_gpio_keys);
  232. }

  233. MIPS_MACHINE(ATH79_MACH_TL_WR881N_V1, "TL-WR881N-v1", "TP-LINK TL-WR881N v1", wr881nv1_setup);
复制代码


评分

参与人数 1恩山币 -1 收起 理由
small_5 -1 别乱灌水

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-2 11:48 | 显示全部楼层
编译N2N出错是怎么回事?
make[4]: Entering directory '/home/LEDE/source/build_dir/target-mips_24kc_musl/n2n-svn5633'
make[4]: *** No targets specified and no makefile found.  Stop.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-2 14:16 | 显示全部楼层
感谢分享,可以正常编译了。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-5 00:37 | 显示全部楼层
感谢楼主编译。试试能不能用在k3上

点评

兄弟的K3能用不?是什么固件?我在混血梅林下不能用  详情 回复 发表于 2018-1-22 20:16
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-5 01:13 来自手机 | 显示全部楼层
奇怪了,为何我编译总是报错,提示没找到源码里的makefile文件,这要怎么弄?搭建服务端搞不了啊,对比了下官网旧版源码,这个新版源码目录的确没有makefile文件,求解啊!

点评

apt-get install subversion build-essential libssl-dev git clone https://github.com/meyerd/n2n.git cd n2n/n2n_v2 mkdir build cd build cmake .. make sudo make install  详情 回复 发表于 2017-12-5 05:45
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-12-5 05:45 | 显示全部楼层
n5413 发表于 2017-12-5 01:13
奇怪了,为何我编译总是报错,提示没找到源码里的makefile文件,这要怎么弄?搭建服务端搞不了啊,对比了下 ...

apt-get install subversion build-essential libssl-dev
git clone https://github.com/meyerd/n2n.git
cd n2n/n2n_v2
mkdir build
cd build
cmake ..
make
sudo make install

点评

原来如此,成功了,太感谢了,不过这个编译这么麻烦,那编译openwrt版本的makefile也要修改吧?能否指点一二,我想给openwrt 15.05编译一份。  详情 回复 发表于 2017-12-5 14:30
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-5 10:47 | 显示全部楼层
能否提供n2n的makefile,我想加入自己的固件,谢谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-5 14:30 | 显示全部楼层
small_5 发表于 2017-12-5 05:45
apt-get install subversion build-essential libssl-dev
git clone https://github.com/meyerd/n2n.git ...

原来如此,成功了,太感谢了,不过这个编译这么麻烦,那编译openwrt版本的makefile也要修改吧?能否指点一二,我想给openwrt 15.05编译一份。

点评

郵箱發給我吧  详情 回复 发表于 2017-12-5 17:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2017-12-5 17:01 | 显示全部楼层
n5413 发表于 2017-12-5 14:30
原来如此,成功了,太感谢了,不过这个编译这么麻烦,那编译openwrt版本的makefile也要修改吧?能否指点 ...

郵箱發給我吧
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-9 02:16 | 显示全部楼层
4.9.65内核装不了,mips,3800,lede

点评

有依赖kmod-tun,这个除了LEDE发行版本有配套的IPK,自编译的只有编译的时候把这个包加进去。  详情 回复 发表于 2017-12-11 20:23
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-12-11 10:42 | 显示全部楼层
small_5 发表于 2017-11-16 12:04
晚点我会加入的。

建议楼主把v1也编辑出来,因为他也有小部分更新的。

另外,如果方便,请把padavan的也编辑出来
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-24 07:38

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表