博客

  • IPV6CP协议

    PPPOE接入IPv4协议栈用的是IPCP协议,IPCP可以分配IPv4地址和DNS服务器,但是不支持IPv6协议,所以就有了IPV6CP协议。
    PPP连接建立后开始执行IPPCP和IPV6CP协议,IPV6CP目前仅定义了接口标识和IPV6压算法(主要是IPv6头压缩),不过目前很少有支持压缩的,所以本文主要说接口标识协商。
    通过Wireshark抓包发现,PPPOE建立连接后会互相发送附带本机接口标识的Request请求给对方,对方收到后会回复Ack包,ack包会携带Request包中的接口标识。

    RFC5072中并没有明确指定接口标识符的生成规则,原话是:

    If an IEEE global identifier is not available, a different source of uniqueness should be used. Suggested sources of uniqueness include link-layer addresses, machine serial numbers, et cetera. In this case, the “u” bit of the interface identifier MUST be set to zero (0).
    If a good source of uniqueness cannot be found, it is recommended that a random number be generated. In this case, the “u” bit of the interface identifier MUST be set to zero (0).

    翻译过来就是可以使用唯一性的链路层地址,机器序列号等,如果没有好的唯一性来源推荐使用随机数来生成。经过测试openwrt和华为AR系列路由器都是用的随机生成,每次拨号接口标识符都会变化。
    IPV6CP协商完成后本端和对端都获得了自己的链路层IPv6地址,并且也知道对方的链路层地址,下一步就可以用ICMP RA或DHCPv6来分配IPv6网络参数了。

    参考:
    IPv6CP主机标识协商
    https://datatracker.ietf.org/doc/rfc5072/
    IPv6CP压缩协议协商
    https://datatracker.ietf.org/doc/rfc5172/
    IPCP
    https://datatracker.ietf.org/doc/rfc1332/

    Views: 4

  • 更新Nexus到3.71

    3.71更换了数据库,必须使用h2或postgresql数据库才能升级成功,而且nexus并不能自动升级数据库,这带来了不小的难度。

    • 备份现有数据库

      在task里面创建一个Admin – Export databases for backup任务

      Backup location选择一个方便访问的位置,备份完成后会出现以.bak结尾的文件。

    • 转换为h2数据库

      下载:https://download.sonatype.com/nexus/nxrm3-migrator/nexus-db-migrator-3.70.1-03.jar
      然后在.bak所在的目录下执行:
      java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M -jar nexus-db-migrator-*.jar --migration_type=h2
      命令执行后会生成nexus.mv.db文件,把这个文件移入db目录
      执行chown 200:200 nexus.mv.db,这一句一定要执行
      然后修改etc/nexus.properties,加入

      nexus.datastore.enabled=true
      nexus.h2.httpListenerEnabled=true
      nexus.h2.httpListenerPort=1234
      
    • 升级数据库

    现在重启nexus等待启动完毕数据库就升级完成了

    • 解决主键重复问题(拉取文件时报500错误)

      进入h2控制台:http://172.30.0.23:1234

      执行以下代码:
      ALTER TABLE TAG ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM TAG; ALTER TABLE RAW_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM RAW_CONTENT_REPOSITORY; ALTER TABLE RAW_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM RAW_COMPONENT; ALTER TABLE RAW_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM RAW_COMPONENT_TAG; ALTER TABLE RAW_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM RAW_ASSET_BLOB; ALTER TABLE APT_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM APT_BROWSE_NODE; ALTER TABLE MAVEN2_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM MAVEN2_CONTENT_REPOSITORY; ALTER TABLE UPGRADE_TASKS ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM UPGRADE_TASKS; ALTER TABLE SOFT_DELETED_BLOBS ALTER COLUMN RECORD_ID RESTART WITH SELECT max(RECORD_ID) + 1 FROM SOFT_DELETED_BLOBS; ALTER TABLE MAVEN2_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM MAVEN2_COMPONENT_TAG; ALTER TABLE MAVEN2_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM MAVEN2_ASSET_BLOB; ALTER TABLE NUGET_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM NUGET_CONTENT_REPOSITORY; ALTER TABLE NPM_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM NPM_BROWSE_NODE; ALTER TABLE NUGET_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM NUGET_ASSET; ALTER TABLE NUGET_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM NUGET_COMPONENT_TAG; ALTER TABLE NUGET_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM NUGET_ASSET_BLOB; ALTER TABLE HELM_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM HELM_CONTENT_REPOSITORY; ALTER TABLE HELM_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM HELM_COMPONENT; ALTER TABLE HELM_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM HELM_COMPONENT_TAG; ALTER TABLE HELM_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM HELM_ASSET_BLOB; ALTER TABLE YUM_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM YUM_BROWSE_NODE; ALTER TABLE DOCKER_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM DOCKER_CONTENT_REPOSITORY; ALTER TABLE DOCKER_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM DOCKER_COMPONENT; ALTER TABLE DOCKER_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM DOCKER_COMPONENT_TAG; ALTER TABLE DOCKER_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM DOCKER_ASSET_BLOB; ALTER TABLE RUBYGEMS_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM RUBYGEMS_BROWSE_NODE; ALTER TABLE PYPI_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM PYPI_CONTENT_REPOSITORY; ALTER TABLE PYPI_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM PYPI_COMPONENT; ALTER TABLE PYPI_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM PYPI_COMPONENT_TAG; ALTER TABLE PYPI_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM PYPI_ASSET_BLOB; ALTER TABLE GITLFS_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM GITLFS_BROWSE_NODE; ALTER TABLE YUM_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM YUM_CONTENT_REPOSITORY; ALTER TABLE YUM_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM YUM_COMPONENT; ALTER TABLE YUM_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM YUM_COMPONENT_TAG; ALTER TABLE YUM_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM YUM_ASSET_BLOB; ALTER TABLE DOCKER_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM DOCKER_BROWSE_NODE; ALTER TABLE NPM_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM NPM_CONTENT_REPOSITORY; ALTER TABLE NPM_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM NPM_COMPONENT; ALTER TABLE NPM_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM NPM_COMPONENT_TAG; ALTER TABLE NPM_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM NPM_ASSET_BLOB; ALTER TABLE RAW_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM RAW_BROWSE_NODE; ALTER TABLE APT_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM APT_CONTENT_REPOSITORY; ALTER TABLE APT_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM APT_COMPONENT; ALTER TABLE APT_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM APT_COMPONENT_TAG; ALTER TABLE APT_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM APT_ASSET_BLOB; ALTER TABLE MAVEN2_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM MAVEN2_BROWSE_NODE; ALTER TABLE CONDA_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM CONDA_CONTENT_REPOSITORY; ALTER TABLE CONDA_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM CONDA_COMPONENT; ALTER TABLE CONDA_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM CONDA_COMPONENT_TAG; ALTER TABLE CONDA_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM CONDA_ASSET_BLOB; ALTER TABLE PYPI_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM PYPI_BROWSE_NODE; ALTER TABLE CONAN_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM CONAN_CONTENT_REPOSITORY; ALTER TABLE CONAN_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM CONAN_COMPONENT; ALTER TABLE CONAN_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM CONAN_COMPONENT_TAG; ALTER TABLE CONAN_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM CONAN_ASSET_BLOB; ALTER TABLE CONDA_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM CONDA_BROWSE_NODE; ALTER TABLE R_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM R_CONTENT_REPOSITORY; ALTER TABLE R_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM R_COMPONENT; ALTER TABLE R_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM R_COMPONENT_TAG; ALTER TABLE R_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM R_ASSET_BLOB; ALTER TABLE CONAN_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM CONAN_BROWSE_NODE; ALTER TABLE GITLFS_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM GITLFS_CONTENT_REPOSITORY; ALTER TABLE GITLFS_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM GITLFS_COMPONENT; ALTER TABLE GITLFS_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM GITLFS_COMPONENT_TAG; ALTER TABLE GITLFS_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM GITLFS_ASSET_BLOB; ALTER TABLE HELM_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM HELM_BROWSE_NODE; ALTER TABLE COCOAPODS_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM COCOAPODS_CONTENT_REPOSITORY; ALTER TABLE COCOAPODS_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM COCOAPODS_COMPONENT; ALTER TABLE COCOAPODS_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM COCOAPODS_COMPONENT_TAG; ALTER TABLE COCOAPODS_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM COCOAPODS_ASSET_BLOB; ALTER TABLE R_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM R_BROWSE_NODE; ALTER TABLE RUBYGEMS_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM RUBYGEMS_CONTENT_REPOSITORY; ALTER TABLE RUBYGEMS_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM RUBYGEMS_COMPONENT; ALTER TABLE RUBYGEMS_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM RUBYGEMS_COMPONENT_TAG; ALTER TABLE RUBYGEMS_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM RUBYGEMS_ASSET_BLOB; ALTER TABLE NUGET_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM NUGET_BROWSE_NODE; ALTER TABLE GO_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM GO_CONTENT_REPOSITORY; ALTER TABLE GO_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM GO_COMPONENT; ALTER TABLE GO_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM GO_COMPONENT_TAG; ALTER TABLE GO_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM GO_ASSET_BLOB; ALTER TABLE COCOAPODS_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM COCOAPODS_BROWSE_NODE; ALTER TABLE P2_CONTENT_REPOSITORY ALTER COLUMN REPOSITORY_ID RESTART WITH SELECT max(REPOSITORY_ID) + 1 FROM P2_CONTENT_REPOSITORY; ALTER TABLE P2_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM P2_COMPONENT; ALTER TABLE P2_COMPONENT_TAG ALTER COLUMN COMPONENT_TAG_ID RESTART WITH SELECT max(COMPONENT_TAG_ID) + 1 FROM P2_COMPONENT_TAG; ALTER TABLE P2_ASSET_BLOB ALTER COLUMN ASSET_BLOB_ID RESTART WITH SELECT max(ASSET_BLOB_ID) + 1 FROM P2_ASSET_BLOB; ALTER TABLE GO_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM GO_BROWSE_NODE; ALTER TABLE MAVEN2_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM MAVEN2_COMPONENT; ALTER TABLE LOGGING_OVERRIDES ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM LOGGING_OVERRIDES; ALTER TABLE BLOB_STORE_METRICS ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM BLOB_STORE_METRICS; ALTER TABLE MAVEN2_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM MAVEN2_ASSET; ALTER TABLE APT_KEY_VALUE ALTER COLUMN KEY_VALUE_ID RESTART WITH SELECT max(KEY_VALUE_ID) + 1 FROM APT_KEY_VALUE; ALTER TABLE APT_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM APT_ASSET; ALTER TABLE RAW_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM RAW_ASSET; ALTER TABLE AGGREGATED_METRICS ALTER COLUMN AGGREGATED_METRIC_ID RESTART WITH SELECT max(AGGREGATED_METRIC_ID) + 1 FROM AGGREGATED_METRICS; ALTER TABLE HISTORICAL_LOGIN_INFO ALTER COLUMN HISTORICAL_LOGIN_INFO_ID RESTART WITH SELECT max(HISTORICAL_LOGIN_INFO_ID) + 1 FROM HISTORICAL_LOGIN_INFO; ALTER TABLE METRICS_LOG ALTER COLUMN METRIC_ID RESTART WITH SELECT max(METRIC_ID) + 1 FROM METRICS_LOG; ALTER TABLE NPM_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM NPM_ASSET; ALTER TABLE NUGET_COMPONENT ALTER COLUMN COMPONENT_ID RESTART WITH SELECT max(COMPONENT_ID) + 1 FROM NUGET_COMPONENT; ALTER TABLE RUBYGEMS_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM RUBYGEMS_ASSET; ALTER TABLE DOWNLOAD_COUNT ALTER COLUMN DOWNLOAD_COUNT_ID RESTART WITH SELECT max(DOWNLOAD_COUNT_ID) + 1 FROM DOWNLOAD_COUNT; ALTER TABLE DOCKER_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM DOCKER_ASSET; ALTER TABLE YUM_KEY_VALUE ALTER COLUMN KEY_VALUE_ID RESTART WITH SELECT max(KEY_VALUE_ID) + 1 FROM YUM_KEY_VALUE; ALTER TABLE YUM_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM YUM_ASSET; ALTER TABLE COMPONENT_APPLICATION_SCAN_SCHEDULE ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM COMPONENT_APPLICATION_SCAN_SCHEDULE; ALTER TABLE COMPONENT_APPLICATION_SCAN ALTER COLUMN ID RESTART WITH SELECT max(ID) + 1 FROM COMPONENT_APPLICATION_SCAN; ALTER TABLE HELM_KEY_VALUE ALTER COLUMN KEY_VALUE_ID RESTART WITH SELECT max(KEY_VALUE_ID) + 1 FROM HELM_KEY_VALUE; ALTER TABLE HELM_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM HELM_ASSET; ALTER TABLE GITLFS_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM GITLFS_ASSET; ALTER TABLE PYPI_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM PYPI_ASSET; ALTER TABLE CONDA_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM CONDA_ASSET; ALTER TABLE CONAN_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM CONAN_ASSET; ALTER TABLE R_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM R_ASSET; ALTER TABLE COCOAPODS_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM COCOAPODS_ASSET; ALTER TABLE GO_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM GO_ASSET; ALTER TABLE P2_ASSET ALTER COLUMN ASSET_ID RESTART WITH SELECT max(ASSET_ID) + 1 FROM P2_ASSET; ALTER TABLE P2_BROWSE_NODE ALTER COLUMN NODE_ID RESTART WITH SELECT max(NODE_ID) + 1 FROM P2_BROWSE_NODE;

    • 升级nexus到3.71

      docker的话直接pull最新版本的镜像即可

    参考:
    https://github.com/sonatype/nexus-public/issues/449
    https://community.sonatype.com/t/migrating-to-3-71-on-a-docker-based-installation/13045

    Views: 22

  • MDNS/DNS-SD相关RFC

    Multicast DNS
    https://datatracker.ietf.org/doc/rfc6762/
    DNS Service Discovery
    https://datatracker.ietf.org/doc/rfc6763/
    DNS-SD代理,有点类似华为的MDNS网关
    https://datatracker.ietf.org/doc/rfc8766/
    一个DNS-SD代理的Python实现
    https://github.com/mkuron/mdns-discovery-proxy
    DNS-SD SRP(服务注册协议),其实就是一个轻量级的专用于DNS-SD的动态DNS协议,DDNS对于DNS-SD来说过于复杂了
    https://datatracker.ietf.org/doc/draft-sctl-service-registration/
    多DNS-SD SRP服务器间同步
    https://datatracker.ietf.org/doc/draft-ietf-dnssd-srp-replication/
    DNS推送,用于主动推送DNS解析结果(事先订阅),只支持TCP协议
    https://datatracker.ietf.org/doc/rfc8765/
    苹果提出的基于UDP的长连接DNS
    https://datatracker.ietf.org/doc/rfc8764/
    基于TCP的长连接DNS
    https://datatracker.ietf.org/doc/rfc8490/
    DNS租约,DHCP有租约,现在DNS也有租约的,主要解决动态DNS过期和删除问题
    https://datatracker.ietf.org/doc/draft-ietf-dnssd-update-lease/
    DNS UPDATE,就是动态DNS
    https://datatracker.ietf.org/doc/rfc2136/
    DNS Over Quic
    https://datatracker.ietf.org/doc/rfc9250/
    DNS SRV服务类型
    http://www.dns-sd.org/ServiceTypes.html

    Views: 3

  • 解决在Windows网上邻居中看不到samba服务

    apt install wssd
    一条命令即可

    Views: 0

  • alpine/openwrt开启mdns

    alpine和openwrt这两个系统用的都是uclibc,但是uclibc没有提供对mdns的任何支持,所以在基于uclibc的系统上使用mdns是一件很困难的事。alpine提供的方案是用avahi2dns把mdns请求转换为普通的dns请求。

    alpine开启mdns

    • mdns服务端支持
      编辑/etc/apk/repositories,添加
      https://mirrors.hetao.me/alpine/edge/testing

      然后执行命令

      apk add avahi
      rc-update add avahi-daemon
      rc-service avahi-daemon start
      
    • mdns客户端支持
      apk add avahi2dns
      rc-update add avahi2dns
      rc-service avahi2dns start
      apk add unbound
      创建/etc/unbound/unbound.conf.d/avahi-local.conf:

       forward-zone:
             name: "local"
             forward-addr: 127.0.0.1@5354
       server:
             do-not-query-localhost: no
             domain-insecure: "local"
      

      编辑/etc/unbound/unbound.conf,添加下面一行
      include: "/etc/unbound/unbound.conf.d/*.conf"
      编辑/etc/unbound/unbound.conf.d/resolvconf.conf

      forward-zone:
              name: "."
              forward-addr: 223.5.5.5
      

      unbound默认是开启dnssec的,如果用自己的dns server需要关闭dnssec.

      编辑/etc/resolv.conf

      nameserver 127.0.0.1
      

      启动unbound服务

      rc-update add unbound
      rc-service unbound start
      

      解析结果:

    openwrt

    • 服务端支持
      参考:https://openwrt.org/docs/guide-developer/mdns
    • 客户端支持
      参考:https://blog.csdn.net/qq_38026359/article/details/121320404
      关于客户端支持也可以采用avahi2dns的方案,不过目前openwrt还没有集成这个包。

    参考:
    https://wiki.alpinelinux.org/wiki/MDNS

    Views: 3

  • python关于全局变量之变量遮蔽

    全局变量在主程序和模块中的行为是不一样的
    – 模块中
    在函数中无论是否使用global声明,都可以通过赋值改变全局变量
    – 主文件中
    如果有global声明则可以通过赋值改变全局变量,但是没有global声明时在函数中无法通过赋值改变全局变量而是创建一个新的局部变量,全局变量中的内容不会改变,但是又可以直接引用全局变量的内容。也就是说读的时候是全局变量,一旦写入就变成了局部变量,这种行为还有一个名词叫变量遮蔽(https://zh.wikipedia.org/wiki/%E8%AE%8A%E6%95%B8%E9%81%AE%E8%94%BD)。
    总结就是除了在主文件中使用global时没有变量遮蔽,其它情况下都会存在遮蔽。

    Views: 6

  • ubuntu上开启mdns/dns-sd

    • 开启mdns客户端
      编辑/etc/nsswitch.conf 文件
      修改hosts行为以下内容
      hosts: files mdns_minimal [NOTFOUND=return] dns mdns
      修改后立即生效
    • 开启mdns服务端
      方法1:
      /etc/systemd/resolved.conf
      systemd restart systemd-resolved
      基于resolved配置静态dnssd服务:https://manpages.ubuntu.com/manpages/jammy/man5/systemd.dnssd.5.html
      反注释MulticastDNS=yes
      方法2:
      apt-get install avahi-daemon
      systemctl restart avahi-daemon
      基于avahi-daemon配置静态dnssd服务:https://linux.die.net/man/5/avahi.service
      resolved和avahi-daemon不能同时使用,虽然avahi-daemon很久没有更新了,但是cpus和libapache2-mod-dnssd还是使用的avahi-daemon的dbus接口,resolved的dbus接口尚没有应用支持。建议使用avahi-daemon.

    使用mdns/dns-sd时必须在/etc/resolv.conf中把dns服务器设为127.0.0.53

    参考:
    https://gist.github.com/jimmydo/e4943950427234408a1aaa2d7beda8b6

    Views: 12

  • 局域网名字解析和服务发现协议对比

    • mdns(Multicast DNS)/dns-sd(DNS Service Discovery)
      支持名字解析和服务发现,由苹果公司最早提出,苹果所有设备和Windows10以上版本默认支持mdns协议,Ubuntu/debian通过libnss的插件nss-mdns提供支持,但没有默认启用。
      mdns使用组播协议进行名字解析,解析到的名字统一放到.local域下。dns-sd是mdns的扩展,与mdns兼容,不但支持组播还支持使用单播进行解析,可以配置自定义域名后缀并与DNS服务器配置完成域名解析,更适合企业环境中使用。
      mdns/dns-sd使用UDP协议,5353端口。
    • SSDP(upnp)
      仅服务发现,没有名字解析功能,ssdp是upnp的组成部分,支持IPv4和IPv6。使用HTTPU/HTTPMU(基于UDP) 1900端口。UPNP提供了设备和服务发现,设备信息获取,设备控制功能,甚至提供了NAT穿透功能,可以作为智能家居设备的底层协义,DLNA投屏协义也是基于UPNP。
    • NBNS(NetBIOS Name Service)/WINS
      不支持IPv6,已经废弃。NetBIOS是一项古老的协议,由IBM开发。WINS是由微软开发的基于NBNS的协议,WINS支持单播,而且支持域名后缀并与DNS服务器集成,更适合企业环境中使用,类似dns-sd与mdns的关系。Windows10以上版本已经废弃NetBIOS的服务发现功能,取而代之的是WSSD和LLMNR(MDNS的支持似乎还不完整,只有名字解析,没有服务发现)。
      nbns/wins使用UDP/TCP协议,137端口。
    • LLMNR(Link-Local Multicast Name Resolution)
      也是提供基于多播协议的DNS解析功能,但仅提供名字解析,没有服务发现功能,与mdns非常类似,由微软件开发因未竞争过mdns所以未成为正式IETF正式标准。LLMNR使用UDP 5355端口。自 2022 年 4 月起,微软已开始逐步淘汰 LLMNR 和NetBIOS名称解析,转而使用mDNS。LLMNR落败的主要原因是没有与普通DNS解析的名称进行区分,导致LLMNR的名字会污染普通的DNS名字造成安全隐患,mdns则是用.local后缀作区分。
    • DDNS(Dynamic Updates in the Domain Name System)
      即动态DNS,与DHCP配合使用,由DHCP服务器把主机名注册到DNS服务器。缺点是静态IP地址就没法用了。

    参考:
    LLMNR
    https://datatracker.ietf.org/doc/rfc4795/
    这篇文章讲解了LLMNR与MDNS的竞争
    https://www.eiman.tv/blog/posts/lannames/
    Multicast DNS
    https://datatracker.ietf.org/doc/rfc6762/
    DNS Service Discovery
    https://datatracker.ietf.org/doc/rfc6763/
    http://www.dns-sd.org/
    DDNS
    https://datatracker.ietf.org/doc/rfc2136/
    libnss的d-bus接口
    https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.resolve1.html
    cups支持systemd-dnssd的issue
    https://github.com/OpenPrinting/libcups/issues/81
    wikipedia的介绍
    https://en.wikipedia.org/wiki/Zero-configuration_networking

    Views: 9

  • 华为路由器PPPOE拨号IPv6不稳定

    表现为IPv6速度慢,有的网站能打开,有的打不开。

    #pppoe口
    int Dialer 1
      mtu 1492
      ipv6 mtu 1492
    #lan口
    int vlanif 2
      mtu 1492
      ipv6 mtu 1492
    

    造成这种问题是原因多方面的:
    – IPv6天生不允许分片
    – 华为路由器的MTU,IPv4和IPv6是分开配置的,PPPOE会自动配置IPv4的MTU为1492,但IPv6不会
    – ipv6 pathmtu被某些设备破坏了或者某些网站pathmtu不正确

    正常情况下IPv6是不需要设置MTU的,IPv6始终使用Path MTU Discovery自动发现正确的MTU,出现这种情况大概率华为设备的PMTUD协议有问题,这种问题仅在华为设备上出现。
    OpenWrt就是有项RA MTU的设置,会把PPPOE接口的MTU通告给下游设备。

    参考:
    https://macgeeker.com/openwrt/ipv6-mtu/
    https://forum.huawei.com/enterprise/zh/thread/blog/703813366742663168

    Views: 4

  • 端口映射协议介绍

    • UPNP IGD V1
      随UPNP于1999年发布,IGD作为UPNP的组成部分提供了添加和删除端口映射,分配租约时间,枚举现有端口映射,了解公共外部IP地址功能,现有的IGD V1实现存在安全漏洞。此为ISO标准,非IETF标准。现已被IGE V2取代
    • UPNP IGD V2
      于2010年发布,增加了IPV6支持,并纠正了值为 0 的无限租用时间的误解。但与微软IGD V1客户端存在兼容性问题。ISO标准,非IETF标准。
    • NAT-PMP
      由IETF定义,是一个独立的端口映射协议,2005年由苹果推出。现已被PCP取代。
      https://datatracker.ietf.org/doc/rfc6886/
    • PCP(Port Control Protocol)
      是NAT-PMP的升级,于2013年公布RFC,支IPv6,支持在CGN和家庭环境中使用,支持生命期管理。
      https://datatracker.ietf.org/doc/rfc6887/

    未来PCP有可能取代其它几种协议

    UPNP+(2.0)已于2015年发布
    https://openconnectivity.org/developer/specifications/upnp-resources/upnp/

    Views: 2