Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjwood committed Sep 6, 2022
2 parents 2e95719 + f897c55 commit 8b30096
Show file tree
Hide file tree
Showing 38 changed files with 2,107 additions and 270 deletions.
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<a href="https://play.google.com/store/apps/details?id=com.aaronjwood.portauthority.free"><img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" height="60"></a>

[![Codacy Badge](https://api.codacy.com/project/badge/grade/74a6e90f803d46a1a39b34daabeb8af1)](https://www.codacy.com/app/aaronjwood/PortAuthority)
[![Build Status](https://travis-ci.org/aaronjwood/PortAuthority.svg)](https://travis-ci.org/aaronjwood/PortAuthority)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/8687/badge.svg)](https://scan.coverity.com/projects/aaronjwood-portauthority)
[![Known Vulnerabilities](https://snyk.io/test/github/aaronjwood/PortAuthority/badge.svg)](https://snyk.io/test/github/aaronjwood/PortAuthority)

Expand Down Expand Up @@ -88,3 +87,8 @@ Like the application and the work I put into it? Consider purchasing the donate
Contributions of any kind are welcome!
Please submit any pull requests to the development branch.
This means that modifications need to be done either on a new branch based off of development or on the development branch directly.

## Privacy
This app does not track, collect, or share any data it comes across with anyone or anything.
There are no ads or analytics trackers in this software.
The service used to determine your public IP address is [open source](https://github.com/aaronjwood/public-ip-api) and is 100% stateless.
33 changes: 21 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ sonarqube {

android {
viewBinding.enabled = true
compileSdkVersion 30
compileSdkVersion 33
buildToolsVersion '30.0.3'

defaultConfig {
minSdkVersion 14
targetSdkVersion 30
versionCode 62
versionName "2.4.0"
minSdkVersion 19
targetSdkVersion 33
versionCode 64
versionName "2.4.2"
applicationId "com.aaronjwood.portauthority"
setProperty("archivesBaseName", "PortAuthority-$versionName")
externalNativeBuild {
ndkBuild {
cppFlags ''
}
}
}

compileOptions {
Expand Down Expand Up @@ -59,19 +64,23 @@ android {
dimension "main"
}
}

lintOptions {
lint {
abortOnError false
}
externalNativeBuild {
ndkBuild {
path file('src/main/c/Android.mk')
}
}

}

dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.9' // Anything past 3.12.x will break our Android 4 support!
implementation 'jcifs:jcifs:1.3.17'
implementation 'org.minidns:minidns-hla:0.3.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.9' // Anything past 3.12.x will break our Android 4 support!
implementation 'org.minidns:minidns-hla:1.0.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:1.10.19'
}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/c/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := ipneigh
LOCAL_SRC_FILES := dnet_ntop.c libnetlink.c ipneigh.c ll_map.c ipx_ntop.c mpls_ntop.c
include $(BUILD_SHARED_LIBRARY)
100 changes: 100 additions & 0 deletions app/src/main/c/dnet_ntop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>

#include "utils.h"

static __inline__ u_int16_t dn_ntohs(u_int16_t addr)
{
union {
u_int8_t byte[2];
u_int16_t word;
} u;

u.word = addr;
return ((u_int16_t)u.byte[0]) | (((u_int16_t)u.byte[1]) << 8);
}

static __inline__ int do_digit(char *str, u_int16_t *addr, u_int16_t scale, size_t *pos, size_t len, int *started)
{
u_int16_t tmp = *addr / scale;

if (*pos == len)
return 1;

if (((tmp) > 0) || *started || (scale == 1)) {
*str = tmp + '0';
*started = 1;
(*pos)++;
*addr -= (tmp * scale);
}

return 0;
}


static const char *dnet_ntop1(const struct dn_naddr *dna, char *str, size_t len)
{
u_int16_t addr, area;
size_t pos = 0;
int started = 0;

memcpy(&addr, dna->a_addr, sizeof(addr));
addr = dn_ntohs(addr);
area = addr >> 10;

if (dna->a_len != 2)
return NULL;

addr &= 0x03ff;

if (len == 0)
return str;

if (do_digit(str + pos, &area, 10, &pos, len, &started))
return str;

if (do_digit(str + pos, &area, 1, &pos, len, &started))
return str;

if (pos == len)
return str;

*(str + pos) = '.';
pos++;
started = 0;

if (do_digit(str + pos, &addr, 1000, &pos, len, &started))
return str;

if (do_digit(str + pos, &addr, 100, &pos, len, &started))
return str;

if (do_digit(str + pos, &addr, 10, &pos, len, &started))
return str;

if (do_digit(str + pos, &addr, 1, &pos, len, &started))
return str;

if (pos == len)
return str;

*(str + pos) = 0;

return str;
}


const char *dnet_ntop(int af, const void *addr, char *str, size_t len)
{
switch(af) {
case AF_DECnet:
errno = 0;
return dnet_ntop1((struct dn_naddr *)addr, str, len);
default:
errno = EAFNOSUPPORT;
}

return NULL;
}
Loading

0 comments on commit 8b30096

Please sign in to comment.