Project

General

Profile

Bug #1952 » 0003-gtp-provide-interface-to-set-family.patch

pablo, 01/31/2024 06:44 PM

View differences:

include/libgtpnl/gtp.h
11 11

  
12 12
void gtp_tunnel_set_ifns(struct gtp_tunnel *t, int ifns);
13 13
void gtp_tunnel_set_ifidx(struct gtp_tunnel *t, uint32_t ifidx);
14
void gtp_tunnel_set_family(struct gtp_tunnel *t, uint16_t family);
14 15
void gtp_tunnel_set_ms_ip4(struct gtp_tunnel *t, struct in_addr *ms_addr);
15 16
void gtp_tunnel_set_sgsn_ip4(struct gtp_tunnel *t, struct in_addr *sgsn_addr);
16 17
void gtp_tunnel_set_ms_ip6(struct gtp_tunnel *t, const struct in6_addr *ms_addr);
src/gtp.c
58 58
}
59 59
EXPORT_SYMBOL(gtp_tunnel_set_ifidx);
60 60

  
61
void gtp_tunnel_set_family(struct gtp_tunnel *t, uint16_t family)
62
{
63
	t->ms_addr.family = family;
64
}
65
EXPORT_SYMBOL(gtp_tunnel_set_family);
66

  
61 67
void gtp_tunnel_set_ms_ip4(struct gtp_tunnel *t, struct in_addr *ms_addr)
62 68
{
63 69
	t->ms_addr.family = AF_INET;
src/libgtpnl.map
43 43
  gtp_tunnel_set_ms_ip6;
44 44
  gtp_tunnel_set_sgsn_ip6;
45 45
} LIBGTPNL_1.0;
46

  
47
LIBGTPNL_1.2 {
48
  gtp_tunnel_set_family;
49
} LIBGTPNL_1.1;
tools/gtp-link.c
75 75
{
76 76
	int fd1 = socket(family, SOCK_DGRAM, 0);
77 77
	int fd2 = socket(family, SOCK_DGRAM, 0);
78
	int one = 1;
78 79

  
79 80
	if (fd1 < 0 || fd2 < 0)
80 81
		return -1;
tools/gtp-tunnel.c
130 130
	struct gtp_tunnel *t;
131 131
	uint32_t gtp_ifidx;
132 132

  
133
	if (argc != 5) {
134
		printf("%s del <gtp device> <version> <tid>\n",
133
	if (argc != 6) {
134
		printf("%s del <gtp device> <version> <tid> <family>\n",
135 135
			argv[0]);
136 136
		return EXIT_FAILURE;
137 137
	}
......
159 159
		return EXIT_FAILURE;
160 160
	}
161 161

  
162
	if (strcmp(argv[5], "ip") == 0) {
163
		gtp_tunnel_set_family(t, AF_INET);
164
	} else if (strcmp(argv[5], "ip6") == 0) {
165
		gtp_tunnel_set_family(t, AF_INET6);
166
	} else {
167
		fprintf(stderr, "wrong family %s, use ip or ip6\n", argv[5]);
168
		gtp_tunnel_free(t);
169
		return EXIT_FAILURE;
170
	}
171

  
162 172
	gtp_del_tunnel(genl_id, nl, t);
163 173

  
164 174
	gtp_tunnel_free(t);
(19-19/33)
Add picture from clipboard (Maximum size: 48.8 MB)