Project

General

Profile

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

pablo, 02/14/2024 10:59 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
131 131
	struct gtp_tunnel *t;
132 132
	uint32_t gtp_ifidx;
133 133

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

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

  
163 173
	gtp_del_tunnel(genl_id, nl, t);
164 174

  
165 175
	gtp_tunnel_free(t);
(26-26/33)
Add picture from clipboard (Maximum size: 48.8 MB)