如何确定BSD / OS X系统上C语言中的标准网关地址?

时间:2018-12-11 13:49:08

标签: c macos networking gateway bsd

我想获取BSD / OS X系统上标准网关的IP地址。

这是一个简单的问题,但是,我很难获得答案。

此帖子: Getting gateway to use for a given ip in ANSI C已经回答了这个问题,但仅适用于非BSD / -OSX系统。

由于在BSD系统上创建Raw套接字很困难,并且没有<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.xxxsys</groupId> <artifactId>yyy-demo-service</artifactId> <version>0.0.1</version> <packaging>jar</packaging> <name>yyy-demo-service</name> <description>Demo</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.16.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Edgware.SR4</spring-cloud.version> <vaadin.version>8.4.4</vaadin.version> </properties> <repositories> <repository> <id>vaadin-addons</id> <url>http://maven.vaadin.com/vaadin-addons</url> </repository> <repository> <id>atlassian-third-party</id> <url>https://maven.atlassian.com/3rdparty/</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-actuator-docs</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-zuul</artifactId> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-themes</artifactId> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-sass-compiler</artifactId> <version>0.9.13</version> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>12.1.0.1-atlassian-hosted</version> <scope>test</scope> </dependency> <!-- new dependencies --> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.6</version> </dependency> <!-- https://mvnrepository.com/artifact/com.jcraft/jsch --> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-jpa</artifactId> <!--<version>1.11.6.RELEASE</version>--> </dependency> <dependency> <groupId>org.vaadin.addon</groupId> <artifactId>confirmdialog</artifactId> <version>3.2.0</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-parameter-names</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jdk8</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> </dependency> <!--<dependency> <groupId>com.thirdparty.teradata</groupId> <artifactId>terajdbc4</artifactId> <version>14.10.00.17</version> </dependency> --> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-push</artifactId> <!-- <version>${vaadin.version}</version> --> </dependency> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-oracle --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-oracle</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-sqlserver --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-sqlserver</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-db2 --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-db2</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-mysql --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-mysql</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-mariadb --> <!--<dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-mariadb</artifactId> <version>14.08.06</version> </dependency> --> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-postgresql --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-postgresql</artifactId> <version>14.21.02</version> </dependency> <!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-generic --> <dependency> <groupId>us.fatehi</groupId> <artifactId>schemacrawler-generic</artifactId> <version>11.02.01</version> </dependency> <!-- https://mvnrepository.com/artifact/postgresql/postgresql --> <!--<dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.1-901-1.jdbc4</version> </dependency> --> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-bom</artifactId> <version>${vaadin.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>com.vaadin</groupId> <artifactId>vaadin-maven-plugin</artifactId> <version>${vaadin.version}</version> <executions> <execution> <goals> <goal>clean</goal> <goal>resources</goal> <goal>update-theme</goal> <goal>update-widgetset</goal> <goal>compile-theme</goal> <goal>compile</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>src/main/webapp</directory> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> </build> </project> 系列,所以我不知道从哪里开始或如何开始。

我唯一发现的是有一个名为PF_ROUTE的家庭,它似乎是用于此目的的正确家庭(PF_NETLINK)。我仍然不知道相应的协议。

自从我不知道如何开始以来,到目前为止我还没有真正尝试过。

0 个答案:

没有答案